mindspore 2.4.0__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -0
- mindspore/ConcurrencyCheck.dll +0 -0
- mindspore/CppBuildInsights.dll +0 -0
- mindspore/CppCoreCheck.dll +0 -0
- mindspore/EnumIndex.dll +0 -0
- mindspore/EspXEngine.dll +0 -0
- mindspore/HResultCheck.dll +0 -0
- mindspore/KernelTraceControl.dll +0 -0
- mindspore/LocalESPC.dll +0 -0
- mindspore/Microsoft.Diagnostics.Tracing.EventSource.dll +0 -0
- mindspore/Microsoft.VisualStudio.RemoteControl.dll +0 -0
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Microsoft.VisualStudio.Utilities.Internal.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- mindspore/VariantClear.dll +0 -0
- mindspore/__init__.py +53 -0
- mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
- mindspore/_check_jit_forbidden_api.py +106 -0
- mindspore/_checkparam.py +1419 -0
- mindspore/_extends/__init__.py +23 -0
- mindspore/_extends/builtin_operations.py +224 -0
- mindspore/_extends/graph_kernel/__init__.py +17 -0
- mindspore/_extends/graph_kernel/model/__init__.py +19 -0
- mindspore/_extends/graph_kernel/model/graph_parallel.py +311 -0
- mindspore/_extends/graph_kernel/model/graph_split.py +1348 -0
- mindspore/_extends/graph_kernel/model/model.py +553 -0
- mindspore/_extends/graph_kernel/model/model_builder.py +216 -0
- mindspore/_extends/graph_kernel/parallel_estimate.py +60 -0
- mindspore/_extends/graph_kernel/splitter.py +140 -0
- mindspore/_extends/graph_kernel/utils.py +28 -0
- mindspore/_extends/parallel_compile/__init__.py +19 -0
- mindspore/_extends/parallel_compile/akg_compiler/__init__.py +19 -0
- mindspore/_extends/parallel_compile/akg_compiler/akg_process.py +269 -0
- mindspore/_extends/parallel_compile/akg_compiler/build_tbe_kernel.py +529 -0
- mindspore/_extends/parallel_compile/akg_compiler/compiler.py +56 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/get_file_path.py +36 -0
- mindspore/_extends/parallel_compile/akg_compiler/tbe_topi.py +556 -0
- mindspore/_extends/parallel_compile/akg_compiler/util.py +159 -0
- mindspore/_extends/parse/__init__.py +49 -0
- mindspore/_extends/parse/compile_config.py +299 -0
- mindspore/_extends/parse/namespace.py +136 -0
- mindspore/_extends/parse/parser.py +1448 -0
- mindspore/_extends/parse/resources.py +213 -0
- mindspore/_extends/parse/standard_method.py +4475 -0
- mindspore/_extends/parse/trope.py +97 -0
- mindspore/_extends/pijit/__init__.py +23 -0
- mindspore/_extends/pijit/pijit_func_white_list.py +669 -0
- mindspore/_extends/remote/__init__.py +19 -0
- mindspore/_extends/remote/kernel_build_server.py +199 -0
- mindspore/_extends/remote/kernel_build_server_akg.py +55 -0
- mindspore/_extends/remote/kernel_build_server_akg_v2.py +55 -0
- mindspore/_extends/remote/kernel_build_server_ascend.py +75 -0
- mindspore/_extends/utils.py +68 -0
- mindspore/_install_custom.py +43 -0
- mindspore/_profiler.py +30 -0
- mindspore/amp.py +433 -0
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/__init__.py +42 -0
- mindspore/boost/adasum.py +319 -0
- mindspore/boost/base.py +535 -0
- mindspore/boost/boost.py +400 -0
- mindspore/boost/boost_cell_wrapper.py +790 -0
- mindspore/boost/dim_reduce.py +323 -0
- mindspore/boost/grad_accumulation.py +79 -0
- mindspore/boost/grad_freeze.py +382 -0
- mindspore/boost/group_loss_scale_manager.py +166 -0
- mindspore/boost/less_batch_normalization.py +174 -0
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/cfgpersist.dll +0 -0
- mindspore/clang_rt.asan_dbg_dynamic-x86_64.dll +0 -0
- mindspore/clang_rt.asan_dynamic-x86_64.dll +0 -0
- mindspore/common/__init__.py +86 -0
- mindspore/common/_auto_dynamic.py +68 -0
- mindspore/common/_decorator.py +50 -0
- mindspore/common/_jit_fallback_utils.py +110 -0
- mindspore/common/_monad.py +25 -0
- mindspore/common/_pijit_context.py +190 -0
- mindspore/common/_register_for_adapter.py +74 -0
- mindspore/common/_register_for_recompute.py +48 -0
- mindspore/common/_register_for_tensor.py +46 -0
- mindspore/common/_stub_tensor.py +210 -0
- mindspore/common/_tensor_overload.py +139 -0
- mindspore/common/_utils.py +122 -0
- mindspore/common/api.py +2064 -0
- mindspore/common/auto_dynamic_shape.py +507 -0
- mindspore/common/dtype.py +422 -0
- mindspore/common/dump.py +130 -0
- mindspore/common/file_system.py +48 -0
- mindspore/common/generator.py +254 -0
- mindspore/common/hook_handle.py +143 -0
- mindspore/common/initializer.py +880 -0
- mindspore/common/jit_config.py +98 -0
- mindspore/common/lazy_inline.py +240 -0
- mindspore/common/mindir_util.py +111 -0
- mindspore/common/mutable.py +234 -0
- mindspore/common/no_inline.py +54 -0
- mindspore/common/np_dtype.py +25 -0
- mindspore/common/parameter.py +1081 -0
- mindspore/common/recompute.py +292 -0
- mindspore/common/seed.py +260 -0
- mindspore/common/sparse_tensor.py +1175 -0
- mindspore/common/symbol.py +122 -0
- mindspore/common/tensor.py +5039 -0
- mindspore/communication/__init__.py +37 -0
- mindspore/communication/_comm_helper.py +501 -0
- mindspore/communication/_hccl_management.py +297 -0
- mindspore/communication/comm_func.py +1395 -0
- mindspore/communication/management.py +673 -0
- mindspore/config/op_info.config +533 -0
- mindspore/context.py +2077 -0
- mindspore/d3dcompiler_47.dll +0 -0
- mindspore/dataset/__init__.py +90 -0
- mindspore/dataset/audio/__init__.py +61 -0
- mindspore/dataset/audio/transforms.py +3690 -0
- mindspore/dataset/audio/utils.py +386 -0
- mindspore/dataset/audio/validators.py +1172 -0
- mindspore/dataset/callback/__init__.py +20 -0
- mindspore/dataset/callback/ds_callback.py +368 -0
- mindspore/dataset/callback/validators.py +32 -0
- mindspore/dataset/core/__init__.py +13 -0
- mindspore/dataset/core/config.py +1095 -0
- mindspore/dataset/core/datatypes.py +101 -0
- mindspore/dataset/core/py_util_helpers.py +65 -0
- mindspore/dataset/core/validator_helpers.py +781 -0
- mindspore/dataset/debug/__init__.py +21 -0
- mindspore/dataset/debug/debug_hook.py +97 -0
- mindspore/dataset/debug/pre_defined_hook.py +67 -0
- mindspore/dataset/engine/__init__.py +124 -0
- mindspore/dataset/engine/cache_admin.py +47 -0
- mindspore/dataset/engine/cache_client.py +129 -0
- mindspore/dataset/engine/datasets.py +4582 -0
- mindspore/dataset/engine/datasets_audio.py +911 -0
- mindspore/dataset/engine/datasets_standard_format.py +543 -0
- mindspore/dataset/engine/datasets_text.py +2161 -0
- mindspore/dataset/engine/datasets_user_defined.py +1184 -0
- mindspore/dataset/engine/datasets_vision.py +4816 -0
- mindspore/dataset/engine/iterators.py +371 -0
- mindspore/dataset/engine/obs/__init__.py +23 -0
- mindspore/dataset/engine/obs/config_loader.py +68 -0
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +508 -0
- mindspore/dataset/engine/obs/util.py +482 -0
- mindspore/dataset/engine/offload.py +596 -0
- mindspore/dataset/engine/queue.py +304 -0
- mindspore/dataset/engine/samplers.py +895 -0
- mindspore/dataset/engine/serializer_deserializer.py +159 -0
- mindspore/dataset/engine/validators.py +2895 -0
- mindspore/dataset/text/__init__.py +51 -0
- mindspore/dataset/text/transforms.py +1703 -0
- mindspore/dataset/text/utils.py +715 -0
- mindspore/dataset/text/validators.py +642 -0
- mindspore/dataset/transforms/__init__.py +45 -0
- mindspore/dataset/transforms/c_transforms.py +638 -0
- mindspore/dataset/transforms/py_transforms.py +393 -0
- mindspore/dataset/transforms/py_transforms_util.py +255 -0
- mindspore/dataset/transforms/transforms.py +1260 -0
- mindspore/dataset/transforms/validators.py +410 -0
- mindspore/dataset/utils/__init__.py +19 -0
- mindspore/dataset/utils/browse_dataset.py +190 -0
- mindspore/dataset/utils/line_reader.py +126 -0
- mindspore/dataset/vision/__init__.py +65 -0
- mindspore/dataset/vision/c_transforms.py +2641 -0
- mindspore/dataset/vision/py_transforms.py +2120 -0
- mindspore/dataset/vision/py_transforms_util.py +1660 -0
- mindspore/dataset/vision/transforms.py +7295 -0
- mindspore/dataset/vision/utils.py +863 -0
- mindspore/dataset/vision/validators.py +1483 -0
- mindspore/default_config.py +2 -0
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/__init__.py +20 -0
- mindspore/experimental/es/__init__.py +22 -0
- mindspore/experimental/es/embedding_service.py +883 -0
- mindspore/experimental/es/embedding_service_layer.py +581 -0
- mindspore/experimental/llm_boost/__init__.py +21 -0
- mindspore/experimental/llm_boost/atb/__init__.py +23 -0
- mindspore/experimental/llm_boost/atb/boost_base.py +211 -0
- mindspore/experimental/llm_boost/atb/llama_boost.py +115 -0
- mindspore/experimental/llm_boost/atb/qwen_boost.py +101 -0
- mindspore/experimental/llm_boost/register.py +129 -0
- mindspore/experimental/llm_boost/utils.py +31 -0
- mindspore/experimental/map_parameter.py +309 -0
- mindspore/experimental/optim/__init__.py +40 -0
- mindspore/experimental/optim/adadelta.py +161 -0
- mindspore/experimental/optim/adagrad.py +168 -0
- mindspore/experimental/optim/adam.py +193 -0
- mindspore/experimental/optim/adamax.py +170 -0
- mindspore/experimental/optim/adamw.py +290 -0
- mindspore/experimental/optim/asgd.py +153 -0
- mindspore/experimental/optim/lr_scheduler.py +1371 -0
- mindspore/experimental/optim/nadam.py +157 -0
- mindspore/experimental/optim/optimizer.py +262 -0
- mindspore/experimental/optim/radam.py +194 -0
- mindspore/experimental/optim/rmsprop.py +154 -0
- mindspore/experimental/optim/rprop.py +164 -0
- mindspore/experimental/optim/sgd.py +156 -0
- mindspore/hal/__init__.py +40 -0
- mindspore/hal/_ascend.py +57 -0
- mindspore/hal/_base.py +57 -0
- mindspore/hal/_cpu.py +56 -0
- mindspore/hal/_gpu.py +57 -0
- mindspore/hal/contiguous_tensors_handle.py +175 -0
- mindspore/hal/device.py +356 -0
- mindspore/hal/event.py +179 -0
- mindspore/hal/memory.py +326 -0
- mindspore/hal/stream.py +357 -0
- mindspore/include/OWNERS +7 -0
- mindspore/include/api/allocator.h +97 -0
- mindspore/include/api/callback/callback.h +93 -0
- mindspore/include/api/callback/ckpt_saver.h +41 -0
- mindspore/include/api/callback/loss_monitor.h +33 -0
- mindspore/include/api/callback/lr_scheduler.h +51 -0
- mindspore/include/api/callback/time_monitor.h +34 -0
- mindspore/include/api/callback/train_accuracy.h +37 -0
- mindspore/include/api/cell.h +90 -0
- mindspore/include/api/cfg.h +82 -0
- mindspore/include/api/context.h +602 -0
- mindspore/include/api/data_type.h +47 -0
- mindspore/include/api/delegate.h +178 -0
- mindspore/include/api/delegate_api.h +75 -0
- mindspore/include/api/dual_abi_helper.h +208 -0
- mindspore/include/api/format.h +28 -0
- mindspore/include/api/graph.h +46 -0
- mindspore/include/api/kernel.h +58 -0
- mindspore/include/api/kernel_api.h +168 -0
- mindspore/include/api/metrics/accuracy.h +36 -0
- mindspore/include/api/metrics/metrics.h +41 -0
- mindspore/include/api/model.h +438 -0
- mindspore/include/api/model_group.h +91 -0
- mindspore/include/api/model_parallel_runner.h +168 -0
- mindspore/include/api/serialization.h +185 -0
- mindspore/include/api/status.h +192 -0
- mindspore/include/api/types.h +431 -0
- mindspore/include/api/visible.h +41 -0
- mindspore/include/c_api/context_c.h +179 -0
- mindspore/include/c_api/data_type_c.h +52 -0
- mindspore/include/c_api/format_c.h +46 -0
- mindspore/include/c_api/model_c.h +347 -0
- mindspore/include/c_api/status_c.h +79 -0
- mindspore/include/c_api/tensor_c.h +146 -0
- mindspore/include/c_api/types_c.h +67 -0
- mindspore/include/dataset/config.h +163 -0
- mindspore/include/dataset/constants.h +363 -0
- mindspore/include/dataset/execute.h +196 -0
- mindspore/include/dataset/text.h +1092 -0
- mindspore/include/dataset/transforms.h +638 -0
- mindspore/include/dataset/vision.h +2129 -0
- mindspore/include/dataset/vision_ascend.h +206 -0
- mindspore/include/dataset/vision_lite.h +625 -0
- mindspore/jpeg62.dll +0 -0
- mindspore/log.py +633 -0
- mindspore/mindrecord/__init__.py +43 -0
- mindspore/mindrecord/common/__init__.py +17 -0
- mindspore/mindrecord/common/constant.py +20 -0
- mindspore/mindrecord/common/enums.py +44 -0
- mindspore/mindrecord/common/exceptions.py +311 -0
- mindspore/mindrecord/config.py +809 -0
- mindspore/mindrecord/filereader.py +174 -0
- mindspore/mindrecord/filewriter.py +722 -0
- mindspore/mindrecord/mindpage.py +210 -0
- mindspore/mindrecord/shardheader.py +141 -0
- mindspore/mindrecord/shardindexgenerator.py +74 -0
- mindspore/mindrecord/shardreader.py +117 -0
- mindspore/mindrecord/shardsegment.py +128 -0
- mindspore/mindrecord/shardutils.py +185 -0
- mindspore/mindrecord/shardwriter.py +237 -0
- mindspore/mindrecord/tools/__init__.py +17 -0
- mindspore/mindrecord/tools/cifar10.py +140 -0
- mindspore/mindrecord/tools/cifar100.py +153 -0
- mindspore/mindrecord/tools/cifar100_to_mr.py +185 -0
- mindspore/mindrecord/tools/cifar10_to_mr.py +177 -0
- mindspore/mindrecord/tools/csv_to_mr.py +200 -0
- mindspore/mindrecord/tools/imagenet_to_mr.py +206 -0
- mindspore/mindrecord/tools/mnist_to_mr.py +259 -0
- mindspore/mindrecord/tools/tfrecord_to_mr.py +360 -0
- mindspore/mindspore_backend.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_np_dtype.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mint/__init__.py +1586 -0
- mindspore/mint/distributed/__init__.py +31 -0
- mindspore/mint/distributed/distributed.py +254 -0
- mindspore/mint/linalg/__init__.py +22 -0
- mindspore/mint/nn/__init__.py +757 -0
- mindspore/mint/nn/functional.py +679 -0
- mindspore/mint/nn/layer/__init__.py +39 -0
- mindspore/mint/nn/layer/activation.py +133 -0
- mindspore/mint/nn/layer/normalization.py +477 -0
- mindspore/mint/nn/layer/pooling.py +110 -0
- mindspore/mint/optim/__init__.py +24 -0
- mindspore/mint/optim/adamw.py +206 -0
- mindspore/mint/special/__init__.py +63 -0
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/multiprocessing/__init__.py +73 -0
- mindspore/nn/__init__.py +47 -0
- mindspore/nn/cell.py +2787 -0
- mindspore/nn/dynamic_lr.py +482 -0
- mindspore/nn/grad/__init__.py +21 -0
- mindspore/nn/grad/cell_grad.py +196 -0
- mindspore/nn/layer/__init__.py +63 -0
- mindspore/nn/layer/activation.py +1822 -0
- mindspore/nn/layer/basic.py +1629 -0
- mindspore/nn/layer/channel_shuffle.py +90 -0
- mindspore/nn/layer/combined.py +248 -0
- mindspore/nn/layer/container.py +734 -0
- mindspore/nn/layer/conv.py +1505 -0
- mindspore/nn/layer/dense.py +204 -0
- mindspore/nn/layer/embedding.py +869 -0
- mindspore/nn/layer/image.py +661 -0
- mindspore/nn/layer/math.py +1069 -0
- mindspore/nn/layer/normalization.py +1273 -0
- mindspore/nn/layer/padding.py +880 -0
- mindspore/nn/layer/pooling.py +2302 -0
- mindspore/nn/layer/rnn_cells.py +388 -0
- mindspore/nn/layer/rnns.py +849 -0
- mindspore/nn/layer/thor_layer.py +963 -0
- mindspore/nn/layer/timedistributed.py +155 -0
- mindspore/nn/layer/transformer.py +823 -0
- mindspore/nn/learning_rate_schedule.py +512 -0
- mindspore/nn/loss/__init__.py +36 -0
- mindspore/nn/loss/loss.py +2924 -0
- mindspore/nn/metrics.py +53 -0
- mindspore/nn/optim/__init__.py +45 -0
- mindspore/nn/optim/_dist_optimizer_registry.py +111 -0
- mindspore/nn/optim/ada_grad.py +217 -0
- mindspore/nn/optim/adadelta.py +206 -0
- mindspore/nn/optim/adafactor.py +448 -0
- mindspore/nn/optim/adam.py +1297 -0
- mindspore/nn/optim/adamax.py +220 -0
- mindspore/nn/optim/adasum.py +548 -0
- mindspore/nn/optim/asgd.py +216 -0
- mindspore/nn/optim/ftrl.py +401 -0
- mindspore/nn/optim/lamb.py +296 -0
- mindspore/nn/optim/lars.py +202 -0
- mindspore/nn/optim/lazyadam.py +533 -0
- mindspore/nn/optim/momentum.py +239 -0
- mindspore/nn/optim/optimizer.py +1034 -0
- mindspore/nn/optim/proximal_ada_grad.py +242 -0
- mindspore/nn/optim/rmsprop.py +264 -0
- mindspore/nn/optim/rprop.py +251 -0
- mindspore/nn/optim/sgd.py +237 -0
- mindspore/nn/optim/tft_wrapper.py +127 -0
- mindspore/nn/optim/thor.py +1310 -0
- mindspore/nn/probability/__init__.py +22 -0
- mindspore/nn/probability/bijector/__init__.py +35 -0
- mindspore/nn/probability/bijector/bijector.py +337 -0
- mindspore/nn/probability/bijector/exp.py +65 -0
- mindspore/nn/probability/bijector/gumbel_cdf.py +144 -0
- mindspore/nn/probability/bijector/invert.py +126 -0
- mindspore/nn/probability/bijector/power_transform.py +196 -0
- mindspore/nn/probability/bijector/scalar_affine.py +167 -0
- mindspore/nn/probability/bijector/softplus.py +189 -0
- mindspore/nn/probability/bnn_layers/__init__.py +29 -0
- mindspore/nn/probability/bnn_layers/_util.py +46 -0
- mindspore/nn/probability/bnn_layers/bnn_cell_wrapper.py +112 -0
- mindspore/nn/probability/bnn_layers/conv_variational.py +267 -0
- mindspore/nn/probability/bnn_layers/dense_variational.py +302 -0
- mindspore/nn/probability/bnn_layers/layer_distribution.py +123 -0
- mindspore/nn/probability/distribution/__init__.py +56 -0
- mindspore/nn/probability/distribution/_utils/__init__.py +34 -0
- mindspore/nn/probability/distribution/_utils/custom_ops.py +96 -0
- mindspore/nn/probability/distribution/_utils/utils.py +362 -0
- mindspore/nn/probability/distribution/bernoulli.py +334 -0
- mindspore/nn/probability/distribution/beta.py +391 -0
- mindspore/nn/probability/distribution/categorical.py +435 -0
- mindspore/nn/probability/distribution/cauchy.py +383 -0
- mindspore/nn/probability/distribution/distribution.py +827 -0
- mindspore/nn/probability/distribution/exponential.py +350 -0
- mindspore/nn/probability/distribution/gamma.py +391 -0
- mindspore/nn/probability/distribution/geometric.py +335 -0
- mindspore/nn/probability/distribution/gumbel.py +257 -0
- mindspore/nn/probability/distribution/half_normal.py +133 -0
- mindspore/nn/probability/distribution/laplace.py +128 -0
- mindspore/nn/probability/distribution/log_normal.py +272 -0
- mindspore/nn/probability/distribution/logistic.py +379 -0
- mindspore/nn/probability/distribution/normal.py +336 -0
- mindspore/nn/probability/distribution/poisson.py +288 -0
- mindspore/nn/probability/distribution/student_t.py +149 -0
- mindspore/nn/probability/distribution/transformed_distribution.py +235 -0
- mindspore/nn/probability/distribution/uniform.py +375 -0
- mindspore/nn/reinforcement/__init__.py +24 -0
- mindspore/nn/reinforcement/_batch_read_write.py +142 -0
- mindspore/nn/reinforcement/_tensors_queue.py +152 -0
- mindspore/nn/reinforcement/tensor_array.py +145 -0
- mindspore/nn/sparse/__init__.py +23 -0
- mindspore/nn/sparse/sparse.py +147 -0
- mindspore/nn/wrap/__init__.py +49 -0
- mindspore/nn/wrap/cell_wrapper.py +968 -0
- mindspore/nn/wrap/grad_reducer.py +608 -0
- mindspore/nn/wrap/loss_scale.py +694 -0
- mindspore/numpy/__init__.py +121 -0
- mindspore/numpy/array_creations.py +2731 -0
- mindspore/numpy/array_ops.py +2629 -0
- mindspore/numpy/dtypes.py +185 -0
- mindspore/numpy/fft.py +966 -0
- mindspore/numpy/logic_ops.py +936 -0
- mindspore/numpy/math_ops.py +5911 -0
- mindspore/numpy/utils.py +214 -0
- mindspore/numpy/utils_const.py +565 -0
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/__init__.py +56 -0
- mindspore/ops/_constants.py +30 -0
- mindspore/ops/_grad_experimental/__init__.py +31 -0
- mindspore/ops/_grad_experimental/grad_array_ops.py +830 -0
- mindspore/ops/_grad_experimental/grad_base.py +143 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +714 -0
- mindspore/ops/_grad_experimental/grad_debug_ops.py +31 -0
- mindspore/ops/_grad_experimental/grad_implementations.py +203 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +79 -0
- mindspore/ops/_grad_experimental/grad_math_ops.py +802 -0
- mindspore/ops/_grad_experimental/grad_nn_ops.py +231 -0
- mindspore/ops/_grad_experimental/grad_quant_ops.py +238 -0
- mindspore/ops/_grad_experimental/grad_sparse.py +342 -0
- mindspore/ops/_grad_experimental/grad_sparse_ops.py +399 -0
- mindspore/ops/_grad_experimental/taylor_rule.py +220 -0
- mindspore/ops/_op_impl/__init__.py +23 -0
- mindspore/ops/_op_impl/_custom_op/__init__.py +39 -0
- mindspore/ops/_op_impl/_custom_op/_basic.py +158 -0
- mindspore/ops/_op_impl/_custom_op/batch_matmul_impl.py +279 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold.py +156 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold2.py +109 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold2_grad.py +125 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold2_grad_reduce.py +105 -0
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold_grad.py +124 -0
- mindspore/ops/_op_impl/_custom_op/cholesky_trsm_impl.py +116 -0
- mindspore/ops/_op_impl/_custom_op/correction_mul.py +89 -0
- mindspore/ops/_op_impl/_custom_op/correction_mul_grad.py +196 -0
- mindspore/ops/_op_impl/_custom_op/dsd_back_impl.py +366 -0
- mindspore/ops/_op_impl/_custom_op/dsd_impl.py +162 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel.py +136 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel_grad.py +206 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel_grad_reduce.py +88 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perlayer.py +128 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perlayer_grad.py +199 -0
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perlayer_grad_reduce.py +88 -0
- mindspore/ops/_op_impl/_custom_op/fake_quant_perchannel.py +156 -0
- mindspore/ops/_op_impl/_custom_op/fake_quant_perchannel_grad.py +184 -0
- mindspore/ops/_op_impl/_custom_op/fake_quant_perlayer.py +143 -0
- mindspore/ops/_op_impl/_custom_op/fake_quant_perlayer_grad.py +169 -0
- mindspore/ops/_op_impl/_custom_op/fused_abs_max1_impl.py +548 -0
- mindspore/ops/_op_impl/_custom_op/img2col_impl.py +881 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_dense_left_impl.py +278 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_dense_right_impl.py +200 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_fracz_left_cast_impl.py +334 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_fracz_right_mul_impl.py +255 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_impl.py +222 -0
- mindspore/ops/_op_impl/_custom_op/matmul_dds_grad_impl.py +644 -0
- mindspore/ops/_op_impl/_custom_op/matmul_dds_impl.py +488 -0
- mindspore/ops/_op_impl/_custom_op/matrix_combine_impl.py +87 -0
- mindspore/ops/_op_impl/_custom_op/minmax_update_perchannel.py +129 -0
- mindspore/ops/_op_impl/_custom_op/minmax_update_perlayer.py +121 -0
- mindspore/ops/_op_impl/_custom_op/transpose02314_impl.py +352 -0
- mindspore/ops/_op_impl/aicpu/__init__.py +441 -0
- mindspore/ops/_op_impl/aicpu/abs.py +36 -0
- mindspore/ops/_op_impl/aicpu/acos.py +32 -0
- mindspore/ops/_op_impl/aicpu/acos_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/acosh.py +34 -0
- mindspore/ops/_op_impl/aicpu/acosh_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/adaptive_avg_pool_2d.py +34 -0
- mindspore/ops/_op_impl/aicpu/adaptive_avg_pool_2d_grad.py +34 -0
- mindspore/ops/_op_impl/aicpu/adaptive_avg_pool_3d.py +39 -0
- mindspore/ops/_op_impl/aicpu/adaptive_avg_pool_3d_grad.py +39 -0
- mindspore/ops/_op_impl/aicpu/adaptive_max_pool_2d.py +37 -0
- mindspore/ops/_op_impl/aicpu/adaptive_max_pool_2d_grad.py +37 -0
- mindspore/ops/_op_impl/aicpu/adaptive_max_pool_3d.py +42 -0
- mindspore/ops/_op_impl/aicpu/adaptive_max_pool_3d_grad.py +152 -0
- mindspore/ops/_op_impl/aicpu/add.py +43 -0
- mindspore/ops/_op_impl/aicpu/add_n.py +41 -0
- mindspore/ops/_op_impl/aicpu/add_v2.py +40 -0
- mindspore/ops/_op_impl/aicpu/addcdiv.py +41 -0
- mindspore/ops/_op_impl/aicpu/addcmul.py +47 -0
- mindspore/ops/_op_impl/aicpu/adjust_contrastv2.py +32 -0
- mindspore/ops/_op_impl/aicpu/adjust_hue.py +31 -0
- mindspore/ops/_op_impl/aicpu/adjust_saturation.py +32 -0
- mindspore/ops/_op_impl/aicpu/affine_grid.py +33 -0
- mindspore/ops/_op_impl/aicpu/affine_grid_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/angle.py +31 -0
- mindspore/ops/_op_impl/aicpu/arg_max.py +75 -0
- mindspore/ops/_op_impl/aicpu/arg_min.py +75 -0
- mindspore/ops/_op_impl/aicpu/argmax_with_value.py +43 -0
- mindspore/ops/_op_impl/aicpu/argmin_with_value.py +43 -0
- mindspore/ops/_op_impl/aicpu/asin.py +32 -0
- mindspore/ops/_op_impl/aicpu/asin_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/asinh.py +34 -0
- mindspore/ops/_op_impl/aicpu/asinh_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/atanh.py +34 -0
- mindspore/ops/_op_impl/aicpu/avgpool_grad_v1.py +37 -0
- mindspore/ops/_op_impl/aicpu/avgpool_v1.py +36 -0
- mindspore/ops/_op_impl/aicpu/bartlett_window.py +36 -0
- mindspore/ops/_op_impl/aicpu/batch_matmul.py +43 -0
- mindspore/ops/_op_impl/aicpu/batch_norm_grad_grad.py +49 -0
- mindspore/ops/_op_impl/aicpu/bernoulli.py +48 -0
- mindspore/ops/_op_impl/aicpu/bessel_i0.py +31 -0
- mindspore/ops/_op_impl/aicpu/betainc.py +31 -0
- mindspore/ops/_op_impl/aicpu/bias_add.py +44 -0
- mindspore/ops/_op_impl/aicpu/bias_add_grad.py +42 -0
- mindspore/ops/_op_impl/aicpu/bincount.py +33 -0
- mindspore/ops/_op_impl/aicpu/blackman_window.py +36 -0
- mindspore/ops/_op_impl/aicpu/broadcast_to.py +58 -0
- mindspore/ops/_op_impl/aicpu/bucketize.py +34 -0
- mindspore/ops/_op_impl/aicpu/cache_swap_table.py +102 -0
- mindspore/ops/_op_impl/aicpu/cast.py +225 -0
- mindspore/ops/_op_impl/aicpu/cauchy.py +33 -0
- mindspore/ops/_op_impl/aicpu/channel_shuffle.py +40 -0
- mindspore/ops/_op_impl/aicpu/check_numerics.py +33 -0
- mindspore/ops/_op_impl/aicpu/cholesky.py +32 -0
- mindspore/ops/_op_impl/aicpu/cholesky_inverse.py +31 -0
- mindspore/ops/_op_impl/aicpu/cholesky_solve.py +33 -0
- mindspore/ops/_op_impl/aicpu/choleskygrad.py +32 -0
- mindspore/ops/_op_impl/aicpu/coalesce.py +37 -0
- mindspore/ops/_op_impl/aicpu/col2im.py +38 -0
- mindspore/ops/_op_impl/aicpu/combined_non_max_suppression.py +42 -0
- mindspore/ops/_op_impl/aicpu/compare_and_bitpack.py +37 -0
- mindspore/ops/_op_impl/aicpu/complex.py +32 -0
- mindspore/ops/_op_impl/aicpu/complex_abs.py +31 -0
- mindspore/ops/_op_impl/aicpu/compute_accidental_hits.py +44 -0
- mindspore/ops/_op_impl/aicpu/concat.py +57 -0
- mindspore/ops/_op_impl/aicpu/concat_offset.py +42 -0
- mindspore/ops/_op_impl/aicpu/concat_offset_v1.py +31 -0
- mindspore/ops/_op_impl/aicpu/conj.py +42 -0
- mindspore/ops/_op_impl/aicpu/conjugate_transpose.py +58 -0
- mindspore/ops/_op_impl/aicpu/cos.py +34 -0
- mindspore/ops/_op_impl/aicpu/cosh.py +34 -0
- mindspore/ops/_op_impl/aicpu/count_nonzero.py +43 -0
- mindspore/ops/_op_impl/aicpu/crop_and_resize.py +69 -0
- mindspore/ops/_op_impl/aicpu/crop_and_resize_grad_boxes.py +68 -0
- mindspore/ops/_op_impl/aicpu/crop_and_resize_grad_image.py +38 -0
- mindspore/ops/_op_impl/aicpu/cross.py +42 -0
- mindspore/ops/_op_impl/aicpu/csr_sparse_matrix_to_dense.py +48 -0
- mindspore/ops/_op_impl/aicpu/csr_sparse_matrix_to_sparse_tensor.py +51 -0
- mindspore/ops/_op_impl/aicpu/ctc_greedy_decoder.py +35 -0
- mindspore/ops/_op_impl/aicpu/ctc_loss_v2.py +43 -0
- mindspore/ops/_op_impl/aicpu/ctc_loss_v2_grad.py +45 -0
- mindspore/ops/_op_impl/aicpu/ctcloss.py +38 -0
- mindspore/ops/_op_impl/aicpu/cummax.py +41 -0
- mindspore/ops/_op_impl/aicpu/cumprod.py +58 -0
- mindspore/ops/_op_impl/aicpu/cumsum.py +58 -0
- mindspore/ops/_op_impl/aicpu/cumulative_logsumexp.py +36 -0
- mindspore/ops/_op_impl/aicpu/data_format_vec_permute.py +32 -0
- mindspore/ops/_op_impl/aicpu/deformable_offsets.py +38 -0
- mindspore/ops/_op_impl/aicpu/deformable_offsets_grad.py +43 -0
- mindspore/ops/_op_impl/aicpu/dense_to_csr_sparse_matrix.py +49 -0
- mindspore/ops/_op_impl/aicpu/dense_to_dense_set_operation.py +45 -0
- mindspore/ops/_op_impl/aicpu/dense_to_sparse_set_operation.py +48 -0
- mindspore/ops/_op_impl/aicpu/depth_to_space.py +44 -0
- mindspore/ops/_op_impl/aicpu/diag.py +36 -0
- mindspore/ops/_op_impl/aicpu/diag_part.py +36 -0
- mindspore/ops/_op_impl/aicpu/diagonal.py +35 -0
- mindspore/ops/_op_impl/aicpu/digamma.py +31 -0
- mindspore/ops/_op_impl/aicpu/div.py +41 -0
- mindspore/ops/_op_impl/aicpu/div_no_nan.py +35 -0
- mindspore/ops/_op_impl/aicpu/dropout2d.py +42 -0
- mindspore/ops/_op_impl/aicpu/dropout3d.py +42 -0
- mindspore/ops/_op_impl/aicpu/dropout_genmask.py +41 -0
- mindspore/ops/_op_impl/aicpu/dropout_genmask_v3.py +32 -0
- mindspore/ops/_op_impl/aicpu/dynamic_stitch.py +42 -0
- mindspore/ops/_op_impl/aicpu/edit_distance.py +56 -0
- mindspore/ops/_op_impl/aicpu/eig.py +35 -0
- mindspore/ops/_op_impl/aicpu/embedding_lookup.py +102 -0
- mindspore/ops/_op_impl/aicpu/end_of_sequence.py +30 -0
- mindspore/ops/_op_impl/aicpu/environ_create.py +28 -0
- mindspore/ops/_op_impl/aicpu/environ_destroy_all.py +28 -0
- mindspore/ops/_op_impl/aicpu/environ_get.py +41 -0
- mindspore/ops/_op_impl/aicpu/environ_set.py +40 -0
- mindspore/ops/_op_impl/aicpu/eps.py +32 -0
- mindspore/ops/_op_impl/aicpu/equal.py +41 -0
- mindspore/ops/_op_impl/aicpu/exp.py +37 -0
- mindspore/ops/_op_impl/aicpu/expand.py +45 -0
- mindspore/ops/_op_impl/aicpu/expand_dims.py +42 -0
- mindspore/ops/_op_impl/aicpu/expm1.py +34 -0
- mindspore/ops/_op_impl/aicpu/extract_glimpse.py +35 -0
- mindspore/ops/_op_impl/aicpu/eye.py +44 -0
- mindspore/ops/_op_impl/aicpu/fft_with_size.py +47 -0
- mindspore/ops/_op_impl/aicpu/fill_diagonal.py +39 -0
- mindspore/ops/_op_impl/aicpu/fill_v2.py +58 -0
- mindspore/ops/_op_impl/aicpu/flatten.py +43 -0
- mindspore/ops/_op_impl/aicpu/floor_div.py +38 -0
- mindspore/ops/_op_impl/aicpu/fmax.py +36 -0
- mindspore/ops/_op_impl/aicpu/fmin.py +37 -0
- mindspore/ops/_op_impl/aicpu/fractional_avg_pool.py +41 -0
- mindspore/ops/_op_impl/aicpu/fractional_avg_pool_grad.py +41 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool.py +41 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool3d_grad_with_fixed_ksize.py +43 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool3d_with_fixed_ksize.py +65 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool_grad.py +42 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool_grad_with_fixed_ksize.py +42 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool_with_fixed_ksize.py +49 -0
- mindspore/ops/_op_impl/aicpu/fse_decode.py +43 -0
- mindspore/ops/_op_impl/aicpu/fused_sparse_adam.py +46 -0
- mindspore/ops/_op_impl/aicpu/fused_sparse_ftrl.py +41 -0
- mindspore/ops/_op_impl/aicpu/fused_sparse_lazy_adam.py +46 -0
- mindspore/ops/_op_impl/aicpu/fused_sparse_proximal_adagrad.py +39 -0
- mindspore/ops/_op_impl/aicpu/gamma.py +38 -0
- mindspore/ops/_op_impl/aicpu/gather.py +46 -0
- mindspore/ops/_op_impl/aicpu/gather_d.py +79 -0
- mindspore/ops/_op_impl/aicpu/gather_d_grad_v2.py +79 -0
- mindspore/ops/_op_impl/aicpu/gather_grad.py +54 -0
- mindspore/ops/_op_impl/aicpu/gather_nd.py +56 -0
- mindspore/ops/_op_impl/aicpu/gcd.py +32 -0
- mindspore/ops/_op_impl/aicpu/generate_eod_mask.py +38 -0
- mindspore/ops/_op_impl/aicpu/geqrf.py +32 -0
- mindspore/ops/_op_impl/aicpu/get_next.py +39 -0
- mindspore/ops/_op_impl/aicpu/glu.py +33 -0
- mindspore/ops/_op_impl/aicpu/glu_grad.py +34 -0
- mindspore/ops/_op_impl/aicpu/greater.py +41 -0
- mindspore/ops/_op_impl/aicpu/greater_equal.py +41 -0
- mindspore/ops/_op_impl/aicpu/grid_sampler_2d.py +35 -0
- mindspore/ops/_op_impl/aicpu/grid_sampler_2d_grad.py +38 -0
- mindspore/ops/_op_impl/aicpu/grid_sampler_3d.py +34 -0
- mindspore/ops/_op_impl/aicpu/grid_sampler_3d_grad.py +38 -0
- mindspore/ops/_op_impl/aicpu/hamming_window.py +57 -0
- mindspore/ops/_op_impl/aicpu/hard_sigmoid.py +32 -0
- mindspore/ops/_op_impl/aicpu/hard_sigmoid_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/heaviside.py +40 -0
- mindspore/ops/_op_impl/aicpu/histogram.py +35 -0
- mindspore/ops/_op_impl/aicpu/hsv_to_rgb.py +32 -0
- mindspore/ops/_op_impl/aicpu/hypot.py +32 -0
- mindspore/ops/_op_impl/aicpu/identity.py +42 -0
- mindspore/ops/_op_impl/aicpu/identity_n.py +41 -0
- mindspore/ops/_op_impl/aicpu/igamma.py +30 -0
- mindspore/ops/_op_impl/aicpu/igammac.py +30 -0
- mindspore/ops/_op_impl/aicpu/igammagrada.py +30 -0
- mindspore/ops/_op_impl/aicpu/im2col.py +43 -0
- mindspore/ops/_op_impl/aicpu/imag.py +31 -0
- mindspore/ops/_op_impl/aicpu/index_fill.py +54 -0
- mindspore/ops/_op_impl/aicpu/index_put.py +50 -0
- mindspore/ops/_op_impl/aicpu/init_data_set_queue.py +27 -0
- mindspore/ops/_op_impl/aicpu/inplace_index_add.py +39 -0
- mindspore/ops/_op_impl/aicpu/instance_norm_v2.py +41 -0
- mindspore/ops/_op_impl/aicpu/instance_norm_v2_grad.py +44 -0
- mindspore/ops/_op_impl/aicpu/is_finite.py +40 -0
- mindspore/ops/_op_impl/aicpu/is_inf.py +31 -0
- mindspore/ops/_op_impl/aicpu/is_nan.py +31 -0
- mindspore/ops/_op_impl/aicpu/kldivloss.py +34 -0
- mindspore/ops/_op_impl/aicpu/kldivlossgrad.py +35 -0
- mindspore/ops/_op_impl/aicpu/layer_norm_grad_grad.py +47 -0
- mindspore/ops/_op_impl/aicpu/lcm.py +32 -0
- mindspore/ops/_op_impl/aicpu/left_shift.py +38 -0
- mindspore/ops/_op_impl/aicpu/less.py +41 -0
- mindspore/ops/_op_impl/aicpu/less_equal.py +41 -0
- mindspore/ops/_op_impl/aicpu/lgamma.py +33 -0
- mindspore/ops/_op_impl/aicpu/linear_sum_assignment.py +57 -0
- mindspore/ops/_op_impl/aicpu/linspace.py +33 -0
- mindspore/ops/_op_impl/aicpu/list_diff.py +50 -0
- mindspore/ops/_op_impl/aicpu/log.py +37 -0
- mindspore/ops/_op_impl/aicpu/log1p.py +34 -0
- mindspore/ops/_op_impl/aicpu/log_matrix_determinant.py +31 -0
- mindspore/ops/_op_impl/aicpu/log_normal_reverse.py +33 -0
- mindspore/ops/_op_impl/aicpu/log_uniform_candidate_sampler.py +37 -0
- mindspore/ops/_op_impl/aicpu/logical_xor.py +30 -0
- mindspore/ops/_op_impl/aicpu/logit.py +33 -0
- mindspore/ops/_op_impl/aicpu/logit_grad.py +34 -0
- mindspore/ops/_op_impl/aicpu/logspace.py +36 -0
- mindspore/ops/_op_impl/aicpu/lower_bound.py +47 -0
- mindspore/ops/_op_impl/aicpu/lstsq.py +34 -0
- mindspore/ops/_op_impl/aicpu/lu.py +39 -0
- mindspore/ops/_op_impl/aicpu/lu_solve.py +32 -0
- mindspore/ops/_op_impl/aicpu/lu_unpack.py +114 -0
- mindspore/ops/_op_impl/aicpu/lu_unpack_grad.py +49 -0
- mindspore/ops/_op_impl/aicpu/masked_fill.py +42 -0
- mindspore/ops/_op_impl/aicpu/masked_scatter.py +40 -0
- mindspore/ops/_op_impl/aicpu/masked_select.py +31 -0
- mindspore/ops/_op_impl/aicpu/masked_select_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/matmul.py +39 -0
- mindspore/ops/_op_impl/aicpu/matrix_band_part.py +59 -0
- mindspore/ops/_op_impl/aicpu/matrix_determinant.py +30 -0
- mindspore/ops/_op_impl/aicpu/matrix_diag_part_v3.py +54 -0
- mindspore/ops/_op_impl/aicpu/matrix_diag_v3.py +56 -0
- mindspore/ops/_op_impl/aicpu/matrix_exp.py +34 -0
- mindspore/ops/_op_impl/aicpu/matrix_inverse.py +31 -0
- mindspore/ops/_op_impl/aicpu/matrix_logarithm.py +31 -0
- mindspore/ops/_op_impl/aicpu/matrix_power.py +37 -0
- mindspore/ops/_op_impl/aicpu/matrix_set_diag_v3.py +54 -0
- mindspore/ops/_op_impl/aicpu/matrix_solve.py +35 -0
- mindspore/ops/_op_impl/aicpu/matrix_solve_ls.py +36 -0
- mindspore/ops/_op_impl/aicpu/matrix_triangular_solve.py +36 -0
- mindspore/ops/_op_impl/aicpu/max_pool3d_grad_with_argmax.py +60 -0
- mindspore/ops/_op_impl/aicpu/max_pool3d_with_argmax.py +59 -0
- mindspore/ops/_op_impl/aicpu/max_unpool2d.py +57 -0
- mindspore/ops/_op_impl/aicpu/max_unpool2d_grad.py +58 -0
- mindspore/ops/_op_impl/aicpu/max_unpool3d.py +57 -0
- mindspore/ops/_op_impl/aicpu/max_unpool3d_grad.py +58 -0
- mindspore/ops/_op_impl/aicpu/maximum_grad_grad.py +40 -0
- mindspore/ops/_op_impl/aicpu/maxpool_grad_v1.py +46 -0
- mindspore/ops/_op_impl/aicpu/maxpool_v1.py +42 -0
- mindspore/ops/_op_impl/aicpu/median.py +39 -0
- mindspore/ops/_op_impl/aicpu/median_grad.py +45 -0
- mindspore/ops/_op_impl/aicpu/meshgrid.py +41 -0
- mindspore/ops/_op_impl/aicpu/minimum_grad_grad.py +40 -0
- mindspore/ops/_op_impl/aicpu/mirror_pad.py +50 -0
- mindspore/ops/_op_impl/aicpu/mirror_pad_grad.py +48 -0
- mindspore/ops/_op_impl/aicpu/mul.py +43 -0
- mindspore/ops/_op_impl/aicpu/mul_no_nan.py +42 -0
- mindspore/ops/_op_impl/aicpu/multi_margin_loss.py +37 -0
- mindspore/ops/_op_impl/aicpu/multi_margin_loss_grad.py +41 -0
- mindspore/ops/_op_impl/aicpu/multilabel_margin_loss_grad.py +37 -0
- mindspore/ops/_op_impl/aicpu/multinomial.py +47 -0
- mindspore/ops/_op_impl/aicpu/multinomial_with_replacement.py +35 -0
- mindspore/ops/_op_impl/aicpu/mvlgamma.py +32 -0
- mindspore/ops/_op_impl/aicpu/mvlgamma_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/nan_to_num.py +34 -0
- mindspore/ops/_op_impl/aicpu/neg.py +36 -0
- mindspore/ops/_op_impl/aicpu/nextafter.py +32 -0
- mindspore/ops/_op_impl/aicpu/nllloss.py +38 -0
- mindspore/ops/_op_impl/aicpu/nllloss_grad.py +39 -0
- mindspore/ops/_op_impl/aicpu/no_repeat_ngram.py +34 -0
- mindspore/ops/_op_impl/aicpu/non_deterministic_ints.py +33 -0
- mindspore/ops/_op_impl/aicpu/non_max_suppression.py +36 -0
- mindspore/ops/_op_impl/aicpu/non_max_suppression_with_overlaps.py +35 -0
- mindspore/ops/_op_impl/aicpu/non_zero.py +43 -0
- mindspore/ops/_op_impl/aicpu/not_equal.py +39 -0
- mindspore/ops/_op_impl/aicpu/nth_element.py +39 -0
- mindspore/ops/_op_impl/aicpu/nuclear_norm.py +33 -0
- mindspore/ops/_op_impl/aicpu/one_hot.py +116 -0
- mindspore/ops/_op_impl/aicpu/ones_like.py +39 -0
- mindspore/ops/_op_impl/aicpu/orgqr.py +34 -0
- mindspore/ops/_op_impl/aicpu/pad_and_shift.py +33 -0
- mindspore/ops/_op_impl/aicpu/pad_v3.py +61 -0
- mindspore/ops/_op_impl/aicpu/pad_v3_grad.py +59 -0
- mindspore/ops/_op_impl/aicpu/padding.py +41 -0
- mindspore/ops/_op_impl/aicpu/parameterized_truncated_normal.py +54 -0
- mindspore/ops/_op_impl/aicpu/pdist_grad.py +33 -0
- mindspore/ops/_op_impl/aicpu/poisson.py +37 -0
- mindspore/ops/_op_impl/aicpu/polar.py +32 -0
- mindspore/ops/_op_impl/aicpu/polygamma.py +34 -0
- mindspore/ops/_op_impl/aicpu/pow.py +39 -0
- mindspore/ops/_op_impl/aicpu/print_tensor.py +39 -0
- mindspore/ops/_op_impl/aicpu/priority_replay_buffer.py +113 -0
- mindspore/ops/_op_impl/aicpu/qr.py +36 -0
- mindspore/ops/_op_impl/aicpu/quant_dtype_cast.py +40 -0
- mindspore/ops/_op_impl/aicpu/quantile.py +35 -0
- mindspore/ops/_op_impl/aicpu/ragged_range.py +49 -0
- mindspore/ops/_op_impl/aicpu/ragged_tensor_to_sparse.py +73 -0
- mindspore/ops/_op_impl/aicpu/ragged_tensor_to_tensor.py +74 -0
- mindspore/ops/_op_impl/aicpu/random_categorical.py +68 -0
- mindspore/ops/_op_impl/aicpu/random_choice_with_mask.py +36 -0
- mindspore/ops/_op_impl/aicpu/random_gamma.py +38 -0
- mindspore/ops/_op_impl/aicpu/random_poisson.py +134 -0
- mindspore/ops/_op_impl/aicpu/random_shuffle.py +47 -0
- mindspore/ops/_op_impl/aicpu/randperm.py +38 -0
- mindspore/ops/_op_impl/aicpu/randperm_v2.py +41 -0
- mindspore/ops/_op_impl/aicpu/range.py +36 -0
- mindspore/ops/_op_impl/aicpu/range_v2.py +35 -0
- mindspore/ops/_op_impl/aicpu/real.py +31 -0
- mindspore/ops/_op_impl/aicpu/real_div.py +40 -0
- mindspore/ops/_op_impl/aicpu/reciprocal.py +34 -0
- mindspore/ops/_op_impl/aicpu/reciprocal_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/reduce_mean.py +57 -0
- mindspore/ops/_op_impl/aicpu/reduce_prod.py +57 -0
- mindspore/ops/_op_impl/aicpu/reduce_sum.py +57 -0
- mindspore/ops/_op_impl/aicpu/relu_grad_v3.py +41 -0
- mindspore/ops/_op_impl/aicpu/relu_v3.py +38 -0
- mindspore/ops/_op_impl/aicpu/reservoir_replay_buffer.py +96 -0
- mindspore/ops/_op_impl/aicpu/reshape.py +42 -0
- mindspore/ops/_op_impl/aicpu/resize_area.py +40 -0
- mindspore/ops/_op_impl/aicpu/resize_bicubic.py +20 -0
- mindspore/ops/_op_impl/aicpu/resize_bicubic_grad.py +19 -0
- mindspore/ops/_op_impl/aicpu/resize_bilinear.py +32 -0
- mindspore/ops/_op_impl/aicpu/resize_bilinear_grad.py +32 -0
- mindspore/ops/_op_impl/aicpu/resize_nearest_neighbor_v2.py +36 -0
- mindspore/ops/_op_impl/aicpu/resize_nearest_neighbor_v2_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/resize_v2.py +68 -0
- mindspore/ops/_op_impl/aicpu/resize_v2_grad.py +68 -0
- mindspore/ops/_op_impl/aicpu/reverse_sequence.py +55 -0
- mindspore/ops/_op_impl/aicpu/reversev2.py +54 -0
- mindspore/ops/_op_impl/aicpu/rgb_to_hsv.py +32 -0
- mindspore/ops/_op_impl/aicpu/right_shift.py +38 -0
- mindspore/ops/_op_impl/aicpu/rnnt_loss.py +35 -0
- mindspore/ops/_op_impl/aicpu/round.py +34 -0
- mindspore/ops/_op_impl/aicpu/rsqrt.py +33 -0
- mindspore/ops/_op_impl/aicpu/rsqrt_grad.py +36 -0
- mindspore/ops/_op_impl/aicpu/sample_distorted_bounding_box_v2.py +49 -0
- mindspore/ops/_op_impl/aicpu/scale_and_translate.py +52 -0
- mindspore/ops/_op_impl/aicpu/scale_and_translate_grad.py +36 -0
- mindspore/ops/_op_impl/aicpu/scatter.py +79 -0
- mindspore/ops/_op_impl/aicpu/scatter_add_with_axis.py +53 -0
- mindspore/ops/_op_impl/aicpu/scatter_elements.py +39 -0
- mindspore/ops/_op_impl/aicpu/scatter_nd.py +59 -0
- mindspore/ops/_op_impl/aicpu/scatter_nd_max.py +54 -0
- mindspore/ops/_op_impl/aicpu/scatter_nd_min.py +54 -0
- mindspore/ops/_op_impl/aicpu/scatter_nd_update.py +59 -0
- mindspore/ops/_op_impl/aicpu/search_sorted.py +44 -0
- mindspore/ops/_op_impl/aicpu/segment_max.py +52 -0
- mindspore/ops/_op_impl/aicpu/segment_mean.py +56 -0
- mindspore/ops/_op_impl/aicpu/segment_min.py +52 -0
- mindspore/ops/_op_impl/aicpu/segment_prod.py +56 -0
- mindspore/ops/_op_impl/aicpu/segment_sum.py +56 -0
- mindspore/ops/_op_impl/aicpu/select.py +45 -0
- mindspore/ops/_op_impl/aicpu/self_adjoint_eig.py +34 -0
- mindspore/ops/_op_impl/aicpu/sequence_add.py +34 -0
- mindspore/ops/_op_impl/aicpu/sequence_add_offset.py +34 -0
- mindspore/ops/_op_impl/aicpu/sequence_addn.py +38 -0
- mindspore/ops/_op_impl/aicpu/sequence_concat.py +40 -0
- mindspore/ops/_op_impl/aicpu/sequence_stack.py +40 -0
- mindspore/ops/_op_impl/aicpu/set_size.py +38 -0
- mindspore/ops/_op_impl/aicpu/sign.py +36 -0
- mindspore/ops/_op_impl/aicpu/sin.py +34 -0
- mindspore/ops/_op_impl/aicpu/sinc.py +43 -0
- mindspore/ops/_op_impl/aicpu/sinh.py +34 -0
- mindspore/ops/_op_impl/aicpu/slice.py +59 -0
- mindspore/ops/_op_impl/aicpu/slice_grad.py +76 -0
- mindspore/ops/_op_impl/aicpu/smooth_l1_loss.py +35 -0
- mindspore/ops/_op_impl/aicpu/smooth_l1_loss_grad.py +37 -0
- mindspore/ops/_op_impl/aicpu/sort.py +39 -0
- mindspore/ops/_op_impl/aicpu/space_to_depth.py +44 -0
- mindspore/ops/_op_impl/aicpu/sparse_addmm.py +87 -0
- mindspore/ops/_op_impl/aicpu/sparse_apply_adagrad_da.py +80 -0
- mindspore/ops/_op_impl/aicpu/sparse_apply_centered_rms_prop.py +105 -0
- mindspore/ops/_op_impl/aicpu/sparse_apply_momentum.py +80 -0
- mindspore/ops/_op_impl/aicpu/sparse_apply_proximal_gradient_descent.py +79 -0
- mindspore/ops/_op_impl/aicpu/sparse_concat.py +59 -0
- mindspore/ops/_op_impl/aicpu/sparse_cross.py +42 -0
- mindspore/ops/_op_impl/aicpu/sparse_dense_cwise_add.py +58 -0
- mindspore/ops/_op_impl/aicpu/sparse_dense_cwise_div.py +58 -0
- mindspore/ops/_op_impl/aicpu/sparse_dense_cwise_mul.py +58 -0
- mindspore/ops/_op_impl/aicpu/sparse_fill_empty_rows.py +63 -0
- mindspore/ops/_op_impl/aicpu/sparse_fill_empty_rows_grad.py +45 -0
- mindspore/ops/_op_impl/aicpu/sparse_matrix_mat_mul.py +56 -0
- mindspore/ops/_op_impl/aicpu/sparse_matrix_nnz.py +81 -0
- mindspore/ops/_op_impl/aicpu/sparse_matrix_transpose.py +116 -0
- mindspore/ops/_op_impl/aicpu/sparse_reorder.py +56 -0
- mindspore/ops/_op_impl/aicpu/sparse_reshape.py +34 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_mean_grad.py +36 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_mean_with_num_segments.py +44 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sqrt_n.py +43 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sqrt_n_grad.py +38 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sqrt_n_with_num_segments.py +44 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sum.py +49 -0
- mindspore/ops/_op_impl/aicpu/sparse_segment_sum_with_num_segments.py +68 -0
- mindspore/ops/_op_impl/aicpu/sparse_slice.py +63 -0
- mindspore/ops/_op_impl/aicpu/sparse_slice_grad.py +61 -0
- mindspore/ops/_op_impl/aicpu/sparse_softmax.py +33 -0
- mindspore/ops/_op_impl/aicpu/sparse_softmax_cross_entropy_with_logits_v2.py +35 -0
- mindspore/ops/_op_impl/aicpu/sparse_sparse_maximum.py +53 -0
- mindspore/ops/_op_impl/aicpu/sparse_sparse_minimum.py +53 -0
- mindspore/ops/_op_impl/aicpu/sparse_tensor_dense_add.py +84 -0
- mindspore/ops/_op_impl/aicpu/sparse_tensor_dense_mat_mul.py +190 -0
- mindspore/ops/_op_impl/aicpu/sparse_tensor_to_csr_sparse_matrix.py +51 -0
- mindspore/ops/_op_impl/aicpu/sparse_to_dense_v2.py +73 -0
- mindspore/ops/_op_impl/aicpu/split.py +45 -0
- mindspore/ops/_op_impl/aicpu/sqrt.py +34 -0
- mindspore/ops/_op_impl/aicpu/sqrt_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/square.py +35 -0
- mindspore/ops/_op_impl/aicpu/squared_difference.py +37 -0
- mindspore/ops/_op_impl/aicpu/squeeze.py +42 -0
- mindspore/ops/_op_impl/aicpu/sspaddmm.py +97 -0
- mindspore/ops/_op_impl/aicpu/stack.py +45 -0
- mindspore/ops/_op_impl/aicpu/stack_push_pop.py +87 -0
- mindspore/ops/_op_impl/aicpu/standard_laplace.py +34 -0
- mindspore/ops/_op_impl/aicpu/standard_normal.py +34 -0
- mindspore/ops/_op_impl/aicpu/stateless_dropout_genmask.py +37 -0
- mindspore/ops/_op_impl/aicpu/stft.py +70 -0
- mindspore/ops/_op_impl/aicpu/strided_slice.py +43 -0
- mindspore/ops/_op_impl/aicpu/strided_slice_grad.py +50 -0
- mindspore/ops/_op_impl/aicpu/sub.py +41 -0
- mindspore/ops/_op_impl/aicpu/sub_and_filter.py +36 -0
- mindspore/ops/_op_impl/aicpu/tan.py +34 -0
- mindspore/ops/_op_impl/aicpu/tanh.py +34 -0
- mindspore/ops/_op_impl/aicpu/tanh_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/tensor_scatter_update.py +59 -0
- mindspore/ops/_op_impl/aicpu/tile.py +56 -0
- mindspore/ops/_op_impl/aicpu/topk.py +34 -0
- mindspore/ops/_op_impl/aicpu/trace.py +40 -0
- mindspore/ops/_op_impl/aicpu/tracegrad.py +41 -0
- mindspore/ops/_op_impl/aicpu/trans_data.py +35 -0
- mindspore/ops/_op_impl/aicpu/transpose.py +58 -0
- mindspore/ops/_op_impl/aicpu/tridiagonal_matmul.py +42 -0
- mindspore/ops/_op_impl/aicpu/tridiagonal_solve.py +35 -0
- mindspore/ops/_op_impl/aicpu/tril.py +42 -0
- mindspore/ops/_op_impl/aicpu/tril_indices.py +34 -0
- mindspore/ops/_op_impl/aicpu/triplet_margin_loss.py +62 -0
- mindspore/ops/_op_impl/aicpu/triu.py +43 -0
- mindspore/ops/_op_impl/aicpu/triu_indices.py +34 -0
- mindspore/ops/_op_impl/aicpu/truncated_normal.py +39 -0
- mindspore/ops/_op_impl/aicpu/uniform.py +36 -0
- mindspore/ops/_op_impl/aicpu/uniform_candidate_sampler.py +41 -0
- mindspore/ops/_op_impl/aicpu/uniform_int.py +36 -0
- mindspore/ops/_op_impl/aicpu/uniform_real.py +33 -0
- mindspore/ops/_op_impl/aicpu/unique.py +31 -0
- mindspore/ops/_op_impl/aicpu/unique_consecutive.py +47 -0
- mindspore/ops/_op_impl/aicpu/unique_with_pad.py +32 -0
- mindspore/ops/_op_impl/aicpu/unravel_index.py +32 -0
- mindspore/ops/_op_impl/aicpu/unsorted_segment_prod.py +53 -0
- mindspore/ops/_op_impl/aicpu/unsorted_segment_sum.py +57 -0
- mindspore/ops/_op_impl/aicpu/unstack.py +45 -0
- mindspore/ops/_op_impl/aicpu/update_cache.py +44 -0
- mindspore/ops/_op_impl/aicpu/upper_bound.py +47 -0
- mindspore/ops/_op_impl/aicpu/upsample_nearest_3d.py +42 -0
- mindspore/ops/_op_impl/aicpu/upsample_nearest_3d_grad.py +49 -0
- mindspore/ops/_op_impl/aicpu/upsample_trilinear_3d.py +40 -0
- mindspore/ops/_op_impl/aicpu/upsample_trilinear_3d_grad.py +50 -0
- mindspore/ops/_op_impl/aicpu/xdivy.py +35 -0
- mindspore/ops/_op_impl/aicpu/xlogy.py +33 -0
- mindspore/ops/_op_impl/aicpu/zeros_like.py +42 -0
- mindspore/ops/_op_impl/aicpu/zeta.py +31 -0
- mindspore/ops/_op_impl/akg/__init__.py +19 -0
- mindspore/ops/_op_impl/akg/ascend/__init__.py +48 -0
- mindspore/ops/_op_impl/akg/ascend/abs.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/add.py +42 -0
- mindspore/ops/_op_impl/akg/ascend/add_n.py +37 -0
- mindspore/ops/_op_impl/akg/ascend/batchmatmul.py +33 -0
- mindspore/ops/_op_impl/akg/ascend/cast.py +46 -0
- mindspore/ops/_op_impl/akg/ascend/equal.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/exp.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/expand_dims.py +33 -0
- mindspore/ops/_op_impl/akg/ascend/greater.py +34 -0
- mindspore/ops/_op_impl/akg/ascend/greater_equal.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/less.py +31 -0
- mindspore/ops/_op_impl/akg/ascend/less_equal.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/load_im2col.py +33 -0
- mindspore/ops/_op_impl/akg/ascend/log.py +34 -0
- mindspore/ops/_op_impl/akg/ascend/maximum.py +36 -0
- mindspore/ops/_op_impl/akg/ascend/minimum.py +39 -0
- mindspore/ops/_op_impl/akg/ascend/mul.py +41 -0
- mindspore/ops/_op_impl/akg/ascend/neg.py +37 -0
- mindspore/ops/_op_impl/akg/ascend/pow.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/prod_force_se_a.py +33 -0
- mindspore/ops/_op_impl/akg/ascend/real_div.py +36 -0
- mindspore/ops/_op_impl/akg/ascend/reciprocal.py +32 -0
- mindspore/ops/_op_impl/akg/ascend/reduce_max.py +32 -0
- mindspore/ops/_op_impl/akg/ascend/reduce_min.py +32 -0
- mindspore/ops/_op_impl/akg/ascend/reduce_sum.py +37 -0
- mindspore/ops/_op_impl/akg/ascend/rsqrt.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/select.py +37 -0
- mindspore/ops/_op_impl/akg/ascend/sqrt.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/square.py +35 -0
- mindspore/ops/_op_impl/akg/ascend/sub.py +42 -0
- mindspore/ops/_op_impl/akg/cpu/__init__.py +23 -0
- mindspore/ops/_op_impl/akg/cpu/coo2csr.py +29 -0
- mindspore/ops/_op_impl/akg/cpu/csr2coo.py +29 -0
- mindspore/ops/_op_impl/akg/cpu/csr_gather.py +33 -0
- mindspore/ops/_op_impl/akg/cpu/csr_mm.py +34 -0
- mindspore/ops/_op_impl/akg/cpu/csr_mul.py +33 -0
- mindspore/ops/_op_impl/akg/cpu/csr_mv.py +33 -0
- mindspore/ops/_op_impl/akg/cpu/csr_reduce_sum.py +31 -0
- mindspore/ops/_op_impl/akg/gpu/__init__.py +24 -0
- mindspore/ops/_op_impl/akg/gpu/coo2csr.py +29 -0
- mindspore/ops/_op_impl/akg/gpu/csr2coo.py +29 -0
- mindspore/ops/_op_impl/akg/gpu/csr_div.py +36 -0
- mindspore/ops/_op_impl/akg/gpu/csr_gather.py +33 -0
- mindspore/ops/_op_impl/akg/gpu/csr_mm.py +37 -0
- mindspore/ops/_op_impl/akg/gpu/csr_mul.py +36 -0
- mindspore/ops/_op_impl/akg/gpu/csr_mv.py +36 -0
- mindspore/ops/_op_impl/akg/gpu/csr_reduce_sum.py +33 -0
- mindspore/ops/_op_impl/cpu/__init__.py +78 -0
- mindspore/ops/_op_impl/cpu/adam.py +49 -0
- mindspore/ops/_op_impl/cpu/adam_weight_decay.py +47 -0
- mindspore/ops/_op_impl/cpu/arg_max.py +30 -0
- mindspore/ops/_op_impl/cpu/arg_max_with_value.py +31 -0
- mindspore/ops/_op_impl/cpu/arg_min_with_value.py +31 -0
- mindspore/ops/_op_impl/cpu/buffer_append.py +28 -0
- mindspore/ops/_op_impl/cpu/buffer_get.py +28 -0
- mindspore/ops/_op_impl/cpu/buffer_sample.py +28 -0
- mindspore/ops/_op_impl/cpu/cast.py +171 -0
- mindspore/ops/_op_impl/cpu/concat_offset.py +38 -0
- mindspore/ops/_op_impl/cpu/conv2d.py +30 -0
- mindspore/ops/_op_impl/cpu/conv3d.py +30 -0
- mindspore/ops/_op_impl/cpu/div.py +32 -0
- mindspore/ops/_op_impl/cpu/dropout.py +31 -0
- mindspore/ops/_op_impl/cpu/dropout_grad.py +30 -0
- mindspore/ops/_op_impl/cpu/dynamic_shape.py +42 -0
- mindspore/ops/_op_impl/cpu/dynamic_stitch.py +41 -0
- mindspore/ops/_op_impl/cpu/equal_count.py +30 -0
- mindspore/ops/_op_impl/cpu/gather_d.py +49 -0
- mindspore/ops/_op_impl/cpu/gather_d_grad.py +38 -0
- mindspore/ops/_op_impl/cpu/gather_d_grad_v2.py +40 -0
- mindspore/ops/_op_impl/cpu/gather_v2.py +40 -0
- mindspore/ops/_op_impl/cpu/hsigmoid.py +33 -0
- mindspore/ops/_op_impl/cpu/hsigmoid_grad.py +34 -0
- mindspore/ops/_op_impl/cpu/hswish.py +32 -0
- mindspore/ops/_op_impl/cpu/hswish_grad.py +33 -0
- mindspore/ops/_op_impl/cpu/identity_n.py +40 -0
- mindspore/ops/_op_impl/cpu/is_finite.py +39 -0
- mindspore/ops/_op_impl/cpu/l2loss.py +30 -0
- mindspore/ops/_op_impl/cpu/layer_norm.py +36 -0
- mindspore/ops/_op_impl/cpu/layer_norm_grad.py +38 -0
- mindspore/ops/_op_impl/cpu/maximum.py +35 -0
- mindspore/ops/_op_impl/cpu/maximum_grad.py +47 -0
- mindspore/ops/_op_impl/cpu/minimum.py +40 -0
- mindspore/ops/_op_impl/cpu/minimum_grad.py +51 -0
- mindspore/ops/_op_impl/cpu/mirror_pad.py +36 -0
- mindspore/ops/_op_impl/cpu/mirror_pad_grad.py +36 -0
- mindspore/ops/_op_impl/cpu/mul.py +32 -0
- mindspore/ops/_op_impl/cpu/one_hot.py +31 -0
- mindspore/ops/_op_impl/cpu/pad.py +32 -0
- mindspore/ops/_op_impl/cpu/pow.py +32 -0
- mindspore/ops/_op_impl/cpu/priority_replay_buffer.py +42 -0
- mindspore/ops/_op_impl/cpu/pyexecute.py +29 -0
- mindspore/ops/_op_impl/cpu/pyfunc.py +29 -0
- mindspore/ops/_op_impl/cpu/range.py +34 -0
- mindspore/ops/_op_impl/cpu/real_div.py +33 -0
- mindspore/ops/_op_impl/cpu/reduce_all.py +29 -0
- mindspore/ops/_op_impl/cpu/reduce_any.py +29 -0
- mindspore/ops/_op_impl/cpu/reduce_max.py +32 -0
- mindspore/ops/_op_impl/cpu/reduce_mean.py +40 -0
- mindspore/ops/_op_impl/cpu/reduce_min.py +32 -0
- mindspore/ops/_op_impl/cpu/reduce_prod.py +40 -0
- mindspore/ops/_op_impl/cpu/reduce_std.py +31 -0
- mindspore/ops/_op_impl/cpu/reduce_sum.py +41 -0
- mindspore/ops/_op_impl/cpu/space_to_batch_nd.py +38 -0
- mindspore/ops/_op_impl/cpu/sparse_slice.py +62 -0
- mindspore/ops/_op_impl/cpu/sparse_slice_grad.py +60 -0
- mindspore/ops/_op_impl/cpu/split.py +34 -0
- mindspore/ops/_op_impl/cpu/sspaddmm.py +95 -0
- mindspore/ops/_op_impl/cpu/stack.py +38 -0
- mindspore/ops/_op_impl/cpu/sub.py +32 -0
- mindspore/ops/_op_impl/cpu/tensor_copy_slices.py +41 -0
- mindspore/ops/_op_impl/cpu/tile.py +37 -0
- mindspore/ops/_op_impl/cpu/top_k.py +31 -0
- mindspore/ops/_op_impl/cpu/transpose.py +39 -0
- mindspore/ops/_primitive_cache.py +90 -0
- mindspore/ops/_register_for_op.py +73 -0
- mindspore/ops/_utils/__init__.py +20 -0
- mindspore/ops/_utils/utils.py +147 -0
- mindspore/ops/_vmap/__init__.py +25 -0
- mindspore/ops/_vmap/vmap_array_ops.py +2149 -0
- mindspore/ops/_vmap/vmap_base.py +533 -0
- mindspore/ops/_vmap/vmap_convolution_ops.py +441 -0
- mindspore/ops/_vmap/vmap_debug_ops.py +50 -0
- mindspore/ops/_vmap/vmap_grad_math_ops.py +274 -0
- mindspore/ops/_vmap/vmap_grad_nn_ops.py +806 -0
- mindspore/ops/_vmap/vmap_image_ops.py +194 -0
- mindspore/ops/_vmap/vmap_math_ops.py +993 -0
- mindspore/ops/_vmap/vmap_nn_ops.py +2250 -0
- mindspore/ops/_vmap/vmap_other_ops.py +105 -0
- mindspore/ops/_vmap/vmap_random_ops.py +122 -0
- mindspore/ops/_vmap/vmap_sparse_ops.py +89 -0
- mindspore/ops/auto_generate/__init__.py +31 -0
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +309 -0
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +252 -0
- mindspore/ops/auto_generate/gen_arg_handler.py +197 -0
- mindspore/ops/auto_generate/gen_extend_func.py +1701 -0
- mindspore/ops/auto_generate/gen_ops_def.py +8482 -0
- mindspore/ops/auto_generate/gen_ops_prim.py +16704 -0
- mindspore/ops/auto_generate/pyboost_inner_prim.py +549 -0
- mindspore/ops/composite/__init__.py +71 -0
- mindspore/ops/composite/base.py +1318 -0
- mindspore/ops/composite/env_ops.py +41 -0
- mindspore/ops/composite/math_ops.py +125 -0
- mindspore/ops/composite/multitype_ops/__init__.py +77 -0
- mindspore/ops/composite/multitype_ops/_compile_utils.py +1459 -0
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +897 -0
- mindspore/ops/composite/multitype_ops/add_impl.py +606 -0
- mindspore/ops/composite/multitype_ops/bitwise_and_impl.py +56 -0
- mindspore/ops/composite/multitype_ops/bitwise_or_impl.py +56 -0
- mindspore/ops/composite/multitype_ops/bitwise_xor_impl.py +56 -0
- mindspore/ops/composite/multitype_ops/div_impl.py +189 -0
- mindspore/ops/composite/multitype_ops/equal_impl.py +335 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +88 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +400 -0
- mindspore/ops/composite/multitype_ops/greater_equal_impl.py +109 -0
- mindspore/ops/composite/multitype_ops/greater_impl.py +110 -0
- mindspore/ops/composite/multitype_ops/in_impl.py +196 -0
- mindspore/ops/composite/multitype_ops/left_shift_impl.py +37 -0
- mindspore/ops/composite/multitype_ops/less_equal_impl.py +111 -0
- mindspore/ops/composite/multitype_ops/less_impl.py +112 -0
- mindspore/ops/composite/multitype_ops/logic_not_impl.py +113 -0
- mindspore/ops/composite/multitype_ops/logical_and_impl.py +60 -0
- mindspore/ops/composite/multitype_ops/logical_or_impl.py +61 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +86 -0
- mindspore/ops/composite/multitype_ops/mul_impl.py +294 -0
- mindspore/ops/composite/multitype_ops/negative_impl.py +79 -0
- mindspore/ops/composite/multitype_ops/not_equal_impl.py +290 -0
- mindspore/ops/composite/multitype_ops/not_in_impl.py +196 -0
- mindspore/ops/composite/multitype_ops/ones_like_impl.py +96 -0
- mindspore/ops/composite/multitype_ops/pow_impl.py +87 -0
- mindspore/ops/composite/multitype_ops/right_shift_impl.py +37 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +884 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +116 -0
- mindspore/ops/composite/multitype_ops/uadd_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +228 -0
- mindspore/ops/deprecated.py +315 -0
- mindspore/ops/function/__init__.py +782 -0
- mindspore/ops/function/array_func.py +7226 -0
- mindspore/ops/function/clip_func.py +384 -0
- mindspore/ops/function/debug_func.py +181 -0
- mindspore/ops/function/fft_func.py +44 -0
- mindspore/ops/function/grad/__init__.py +34 -0
- mindspore/ops/function/grad/grad_func.py +1425 -0
- mindspore/ops/function/image_func.py +292 -0
- mindspore/ops/function/linalg_func.py +416 -0
- mindspore/ops/function/math_func.py +12228 -0
- mindspore/ops/function/nn_func.py +8609 -0
- mindspore/ops/function/other_func.py +115 -0
- mindspore/ops/function/parameter_func.py +134 -0
- mindspore/ops/function/random_func.py +1715 -0
- mindspore/ops/function/reshard_func.py +104 -0
- mindspore/ops/function/sparse_func.py +884 -0
- mindspore/ops/function/sparse_unary_func.py +2422 -0
- mindspore/ops/function/spectral_func.py +150 -0
- mindspore/ops/function/vmap_func.py +117 -0
- mindspore/ops/functional.py +464 -0
- mindspore/ops/op_info_register.py +1572 -0
- mindspore/ops/operations/__init__.py +722 -0
- mindspore/ops/operations/_csr_ops.py +403 -0
- mindspore/ops/operations/_custom_grad.py +181 -0
- mindspore/ops/operations/_embedding_cache_ops.py +307 -0
- mindspore/ops/operations/_grad_ops.py +2978 -0
- mindspore/ops/operations/_infer_ops.py +19 -0
- mindspore/ops/operations/_inner_ops.py +2544 -0
- mindspore/ops/operations/_map_tensor_ops.py +112 -0
- mindspore/ops/operations/_ms_kernel.py +601 -0
- mindspore/ops/operations/_ocr_ops.py +379 -0
- mindspore/ops/operations/_opaque_predicate_registry.py +41 -0
- mindspore/ops/operations/_pyfunc_registry.py +58 -0
- mindspore/ops/operations/_quant_ops.py +1844 -0
- mindspore/ops/operations/_rl_inner_ops.py +1231 -0
- mindspore/ops/operations/_scalar_ops.py +106 -0
- mindspore/ops/operations/_sequence_ops.py +1155 -0
- mindspore/ops/operations/_sparse_grad_ops.py +56 -0
- mindspore/ops/operations/_tensor_array.py +359 -0
- mindspore/ops/operations/_thor_ops.py +807 -0
- mindspore/ops/operations/array_ops.py +6124 -0
- mindspore/ops/operations/comm_ops.py +1985 -0
- mindspore/ops/operations/control_ops.py +127 -0
- mindspore/ops/operations/custom_ops.py +1129 -0
- mindspore/ops/operations/debug_ops.py +678 -0
- mindspore/ops/operations/image_ops.py +1041 -0
- mindspore/ops/operations/inner_ops.py +697 -0
- mindspore/ops/operations/linalg_ops.py +95 -0
- mindspore/ops/operations/manually_defined/__init__.py +24 -0
- mindspore/ops/operations/manually_defined/_inner.py +73 -0
- mindspore/ops/operations/manually_defined/ops_def.py +2271 -0
- mindspore/ops/operations/math_ops.py +5095 -0
- mindspore/ops/operations/nn_ops.py +9575 -0
- mindspore/ops/operations/other_ops.py +874 -0
- mindspore/ops/operations/random_ops.py +1288 -0
- mindspore/ops/operations/reshard_ops.py +53 -0
- mindspore/ops/operations/rl_ops.py +288 -0
- mindspore/ops/operations/sparse_ops.py +2753 -0
- mindspore/ops/operations/spectral_ops.py +111 -0
- mindspore/ops/primitive.py +1046 -0
- mindspore/ops/signature.py +54 -0
- mindspore/ops/vm_impl_registry.py +91 -0
- mindspore/ops_generate/__init__.py +27 -0
- mindspore/ops_generate/arg_dtype_cast.py +252 -0
- mindspore/ops_generate/arg_handler.py +197 -0
- mindspore/ops_generate/gen_aclnn_implement.py +263 -0
- mindspore/ops_generate/gen_constants.py +36 -0
- mindspore/ops_generate/gen_ops.py +1099 -0
- mindspore/ops_generate/gen_ops_inner_prim.py +131 -0
- mindspore/ops_generate/gen_pyboost_func.py +1052 -0
- mindspore/ops_generate/gen_utils.py +209 -0
- mindspore/ops_generate/op_proto.py +145 -0
- mindspore/ops_generate/pyboost_utils.py +367 -0
- mindspore/ops_generate/template.py +261 -0
- mindspore/parallel/__init__.py +30 -0
- mindspore/parallel/_auto_parallel_context.py +1486 -0
- mindspore/parallel/_cell_wrapper.py +174 -0
- mindspore/parallel/_cost_model_context.py +700 -0
- mindspore/parallel/_dp_allreduce_fusion.py +159 -0
- mindspore/parallel/_offload_context.py +275 -0
- mindspore/parallel/_parallel_serialization.py +561 -0
- mindspore/parallel/_ps_context.py +242 -0
- mindspore/parallel/_recovery_context.py +110 -0
- mindspore/parallel/_tensor.py +730 -0
- mindspore/parallel/_transformer/__init__.py +35 -0
- mindspore/parallel/_transformer/layers.py +765 -0
- mindspore/parallel/_transformer/loss.py +251 -0
- mindspore/parallel/_transformer/moe.py +693 -0
- mindspore/parallel/_transformer/op_parallel_config.py +222 -0
- mindspore/parallel/_transformer/transformer.py +3119 -0
- mindspore/parallel/_utils.py +612 -0
- mindspore/parallel/algo_parameter_config.py +400 -0
- mindspore/parallel/checkpoint_transform.py +650 -0
- mindspore/parallel/cluster/__init__.py +15 -0
- mindspore/parallel/cluster/process_entity/__init__.py +18 -0
- mindspore/parallel/cluster/process_entity/_api.py +352 -0
- mindspore/parallel/cluster/process_entity/_utils.py +101 -0
- mindspore/parallel/cluster/run.py +136 -0
- mindspore/parallel/mpi/__init__.py +14 -0
- mindspore/parallel/mpi/_mpi_config.py +116 -0
- mindspore/parallel/parameter_broadcast.py +151 -0
- mindspore/parallel/shard.py +481 -0
- mindspore/parallel/transform_safetensors.py +993 -0
- mindspore/perf_msvcbuildinsights.dll +0 -0
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +28 -0
- mindspore/profiler/common/__init__.py +14 -0
- mindspore/profiler/common/constant.py +29 -0
- mindspore/profiler/common/exceptions/__init__.py +14 -0
- mindspore/profiler/common/exceptions/error_code.py +83 -0
- mindspore/profiler/common/exceptions/exceptions.py +286 -0
- mindspore/profiler/common/process_pool.py +41 -0
- mindspore/profiler/common/registry.py +47 -0
- mindspore/profiler/common/singleton.py +28 -0
- mindspore/profiler/common/struct_type.py +118 -0
- mindspore/profiler/common/util.py +472 -0
- mindspore/profiler/common/validator/__init__.py +14 -0
- mindspore/profiler/common/validator/validate_path.py +84 -0
- mindspore/profiler/dynamic_profiler.py +694 -0
- mindspore/profiler/envprofiling.py +254 -0
- mindspore/profiler/parser/__init__.py +14 -0
- mindspore/profiler/parser/aicpu_data_parser.py +272 -0
- mindspore/profiler/parser/ascend_analysis/__init__.py +14 -0
- mindspore/profiler/parser/ascend_analysis/constant.py +71 -0
- mindspore/profiler/parser/ascend_analysis/file_manager.py +180 -0
- mindspore/profiler/parser/ascend_analysis/function_event.py +185 -0
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +136 -0
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +131 -0
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +104 -0
- mindspore/profiler/parser/ascend_analysis/path_manager.py +313 -0
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +123 -0
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +86 -0
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +75 -0
- mindspore/profiler/parser/ascend_cluster_generator.py +116 -0
- mindspore/profiler/parser/ascend_communicate_generator.py +314 -0
- mindspore/profiler/parser/ascend_flops_generator.py +116 -0
- mindspore/profiler/parser/ascend_fpbp_generator.py +82 -0
- mindspore/profiler/parser/ascend_hccl_generator.py +271 -0
- mindspore/profiler/parser/ascend_integrate_generator.py +42 -0
- mindspore/profiler/parser/ascend_memory_generator.py +185 -0
- mindspore/profiler/parser/ascend_msprof_exporter.py +282 -0
- mindspore/profiler/parser/ascend_msprof_generator.py +187 -0
- mindspore/profiler/parser/ascend_op_generator.py +334 -0
- mindspore/profiler/parser/ascend_steptrace_generator.py +94 -0
- mindspore/profiler/parser/ascend_timeline_generator.py +545 -0
- mindspore/profiler/parser/base_timeline_generator.py +483 -0
- mindspore/profiler/parser/container.py +229 -0
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +697 -0
- mindspore/profiler/parser/flops_parser.py +531 -0
- mindspore/profiler/parser/framework_enum.py +111 -0
- mindspore/profiler/parser/framework_parser.py +464 -0
- mindspore/profiler/parser/framework_struct.py +61 -0
- mindspore/profiler/parser/gpu_analysis/__init__.py +14 -0
- mindspore/profiler/parser/gpu_analysis/function_event.py +44 -0
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +89 -0
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +72 -0
- mindspore/profiler/parser/hccl_parser.py +573 -0
- mindspore/profiler/parser/hwts_log_parser.py +122 -0
- mindspore/profiler/parser/integrator.py +526 -0
- mindspore/profiler/parser/memory_usage_parser.py +277 -0
- mindspore/profiler/parser/minddata_analyzer.py +800 -0
- mindspore/profiler/parser/minddata_parser.py +186 -0
- mindspore/profiler/parser/minddata_pipeline_parser.py +299 -0
- mindspore/profiler/parser/op_intermediate_parser.py +149 -0
- mindspore/profiler/parser/optime_parser.py +250 -0
- mindspore/profiler/parser/profiler_info.py +213 -0
- mindspore/profiler/parser/step_trace_parser.py +666 -0
- mindspore/profiler/profiler.py +153 -0
- mindspore/profiler/profiling.py +1922 -0
- mindspore/rewrite/__init__.py +28 -0
- mindspore/rewrite/api/__init__.py +17 -0
- mindspore/rewrite/api/node.py +519 -0
- mindspore/rewrite/api/node_type.py +53 -0
- mindspore/rewrite/api/pattern_engine.py +490 -0
- mindspore/rewrite/api/scoped_value.py +181 -0
- mindspore/rewrite/api/symbol_tree.py +497 -0
- mindspore/rewrite/ast_helpers/__init__.py +25 -0
- mindspore/rewrite/ast_helpers/ast_converter.py +143 -0
- mindspore/rewrite/ast_helpers/ast_finder.py +404 -0
- mindspore/rewrite/ast_helpers/ast_flattener.py +268 -0
- mindspore/rewrite/ast_helpers/ast_modifier.py +605 -0
- mindspore/rewrite/ast_helpers/ast_replacer.py +79 -0
- mindspore/rewrite/common/__init__.py +19 -0
- mindspore/rewrite/common/config.py +24 -0
- mindspore/rewrite/common/error_log.py +39 -0
- mindspore/rewrite/common/event.py +28 -0
- mindspore/rewrite/common/namer.py +271 -0
- mindspore/rewrite/common/namespace.py +118 -0
- mindspore/rewrite/common/observable.py +44 -0
- mindspore/rewrite/common/observer.py +54 -0
- mindspore/rewrite/node/__init__.py +22 -0
- mindspore/rewrite/node/call_function.py +95 -0
- mindspore/rewrite/node/cell_container.py +139 -0
- mindspore/rewrite/node/control_flow.py +113 -0
- mindspore/rewrite/node/node.py +1428 -0
- mindspore/rewrite/node/node_manager.py +283 -0
- mindspore/rewrite/node/node_topological_manager.py +223 -0
- mindspore/rewrite/parsers/__init__.py +29 -0
- mindspore/rewrite/parsers/arguments_parser.py +63 -0
- mindspore/rewrite/parsers/assign_parser.py +852 -0
- mindspore/rewrite/parsers/attribute_parser.py +57 -0
- mindspore/rewrite/parsers/class_def_parser.py +289 -0
- mindspore/rewrite/parsers/constant_parser.py +104 -0
- mindspore/rewrite/parsers/container_parser.py +88 -0
- mindspore/rewrite/parsers/expr_parser.py +55 -0
- mindspore/rewrite/parsers/for_parser.py +61 -0
- mindspore/rewrite/parsers/function_def_parser.py +84 -0
- mindspore/rewrite/parsers/if_parser.py +85 -0
- mindspore/rewrite/parsers/module_parser.py +117 -0
- mindspore/rewrite/parsers/parser.py +43 -0
- mindspore/rewrite/parsers/parser_register.py +86 -0
- mindspore/rewrite/parsers/return_parser.py +37 -0
- mindspore/rewrite/parsers/while_parser.py +59 -0
- mindspore/rewrite/sparsify/__init__.py +0 -0
- mindspore/rewrite/sparsify/sparse_transformer.py +457 -0
- mindspore/rewrite/sparsify/sparsify.py +112 -0
- mindspore/rewrite/sparsify/utils.py +179 -0
- mindspore/rewrite/symbol_tree/__init__.py +20 -0
- mindspore/rewrite/symbol_tree/symbol_tree.py +1819 -0
- mindspore/rewrite/symbol_tree/symbol_tree_builder.py +76 -0
- mindspore/rewrite/symbol_tree/symbol_tree_dumper.py +142 -0
- mindspore/run_check/__init__.py +20 -0
- mindspore/run_check/_check_version.py +507 -0
- mindspore/run_check/run_check.py +66 -0
- mindspore/safeguard/__init__.py +18 -0
- mindspore/safeguard/rewrite_obfuscation.py +875 -0
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/__init__.py +48 -0
- mindspore/train/_utils.py +465 -0
- mindspore/train/amp.py +935 -0
- mindspore/train/anf_ir_pb2.py +1517 -0
- mindspore/train/callback/__init__.py +44 -0
- mindspore/train/callback/_backup_and_restore.py +117 -0
- mindspore/train/callback/_callback.py +613 -0
- mindspore/train/callback/_checkpoint.py +814 -0
- mindspore/train/callback/_cluster_monitor.py +201 -0
- mindspore/train/callback/_dataset_graph.py +150 -0
- mindspore/train/callback/_early_stop.py +239 -0
- mindspore/train/callback/_flops_collector.py +239 -0
- mindspore/train/callback/_history.py +92 -0
- mindspore/train/callback/_lambda_callback.py +80 -0
- mindspore/train/callback/_landscape.py +1049 -0
- mindspore/train/callback/_loss_monitor.py +107 -0
- mindspore/train/callback/_lr_scheduler_callback.py +76 -0
- mindspore/train/callback/_on_request_exit.py +298 -0
- mindspore/train/callback/_reduce_lr_on_plateau.py +226 -0
- mindspore/train/callback/_summary_collector.py +1184 -0
- mindspore/train/callback/_tft_register.py +352 -0
- mindspore/train/callback/_time_monitor.py +141 -0
- mindspore/train/checkpoint_pb2.py +233 -0
- mindspore/train/data_sink.py +219 -0
- mindspore/train/dataset_helper.py +692 -0
- mindspore/train/lineage_pb2.py +1260 -0
- mindspore/train/loss_scale_manager.py +213 -0
- mindspore/train/memory_profiling_pb2.py +298 -0
- mindspore/train/metrics/__init__.py +175 -0
- mindspore/train/metrics/accuracy.py +133 -0
- mindspore/train/metrics/auc.py +129 -0
- mindspore/train/metrics/bleu_score.py +170 -0
- mindspore/train/metrics/confusion_matrix.py +700 -0
- mindspore/train/metrics/cosine_similarity.py +109 -0
- mindspore/train/metrics/dice.py +116 -0
- mindspore/train/metrics/error.py +175 -0
- mindspore/train/metrics/fbeta.py +167 -0
- mindspore/train/metrics/hausdorff_distance.py +333 -0
- mindspore/train/metrics/loss.py +97 -0
- mindspore/train/metrics/mean_surface_distance.py +189 -0
- mindspore/train/metrics/metric.py +373 -0
- mindspore/train/metrics/occlusion_sensitivity.py +225 -0
- mindspore/train/metrics/perplexity.py +133 -0
- mindspore/train/metrics/precision.py +160 -0
- mindspore/train/metrics/recall.py +159 -0
- mindspore/train/metrics/roc.py +223 -0
- mindspore/train/metrics/root_mean_square_surface_distance.py +191 -0
- mindspore/train/metrics/topk.py +167 -0
- mindspore/train/mind_ir_pb2.py +1908 -0
- mindspore/train/model.py +2252 -0
- mindspore/train/node_strategy_pb2.py +653 -0
- mindspore/train/print_pb2.py +184 -0
- mindspore/train/profiling_parallel_pb2.py +151 -0
- mindspore/train/serialization.py +3325 -0
- mindspore/train/summary/__init__.py +23 -0
- mindspore/train/summary/_lineage_adapter.py +41 -0
- mindspore/train/summary/_summary_adapter.py +496 -0
- mindspore/train/summary/_writer_pool.py +207 -0
- mindspore/train/summary/enums.py +56 -0
- mindspore/train/summary/summary_record.py +581 -0
- mindspore/train/summary/writer.py +167 -0
- mindspore/train/summary_pb2.py +1165 -0
- mindspore/train/train_thor/__init__.py +20 -0
- mindspore/train/train_thor/convert_utils.py +268 -0
- mindspore/train/train_thor/dataset_helper.py +192 -0
- mindspore/train/train_thor/model_thor.py +257 -0
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +21 -0
- mindspore/utils/utils.py +60 -0
- mindspore/vcmeta.dll +0 -0
- mindspore/vcomp140.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -0
- mindspore-2.4.0.dist-info/METADATA +352 -0
- mindspore-2.4.0.dist-info/RECORD +1406 -0
- mindspore-2.4.0.dist-info/WHEEL +5 -0
- mindspore-2.4.0.dist-info/entry_points.txt +3 -0
- mindspore-2.4.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1483 @@
|
|
|
1
|
+
# Copyright 2019-2022 Huawei Technologies Co., Ltd
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ==============================================================================
|
|
15
|
+
"""Validators for image processing operations.
|
|
16
|
+
"""
|
|
17
|
+
import numbers
|
|
18
|
+
from functools import wraps
|
|
19
|
+
import numpy as np
|
|
20
|
+
|
|
21
|
+
from mindspore._c_dataengine import TensorOp, TensorOperation
|
|
22
|
+
from mindspore._c_expression import typing
|
|
23
|
+
from mindspore.dataset.core.validator_helpers import check_value, check_uint8, FLOAT_MIN_INTEGER, FLOAT_MAX_INTEGER, \
|
|
24
|
+
check_pos_float32, check_float32, check_2tuple, check_range, check_positive, INT32_MAX, INT32_MIN, \
|
|
25
|
+
parse_user_args, type_check, type_check_list, check_c_tensor_op, UINT8_MAX, UINT8_MIN, check_value_normalize_std, \
|
|
26
|
+
check_value_cutoff, check_value_ratio, check_odd, check_non_negative_float32, check_non_negative_int32, \
|
|
27
|
+
check_pos_int32, check_int32, check_tensor_op, deprecator_factory, check_valid_str, check_independent_mode
|
|
28
|
+
from mindspore.dataset.transforms.validators import check_transform_op_type
|
|
29
|
+
from .utils import Inter, Border, ImageBatchFormat, ConvertMode, SliceMode, AutoAugmentPolicy
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def check_affine(method):
|
|
33
|
+
"""Wrapper method to check the parameters of Affine."""
|
|
34
|
+
@wraps(method)
|
|
35
|
+
def new_method(self, *args, **kwargs):
|
|
36
|
+
[degrees, translate, scale, shear, resample, fill_value], _ = parse_user_args(method, *args, **kwargs)
|
|
37
|
+
|
|
38
|
+
type_check(degrees, (int, float), "degrees")
|
|
39
|
+
check_value(degrees, [-180, 180], "degrees")
|
|
40
|
+
|
|
41
|
+
type_check(translate, (list, tuple), "translate")
|
|
42
|
+
if len(translate) != 2:
|
|
43
|
+
raise TypeError("The length of translate should be 2.")
|
|
44
|
+
for i, t in enumerate(translate):
|
|
45
|
+
type_check(t, (int, float), "translate[{}]".format(i))
|
|
46
|
+
check_value(t, [-1.0, 1.0], "translate[{}]".format(i))
|
|
47
|
+
|
|
48
|
+
type_check(scale, (int, float), "scale")
|
|
49
|
+
check_positive(scale, "scale")
|
|
50
|
+
|
|
51
|
+
type_check(shear, (numbers.Number, tuple, list), "shear")
|
|
52
|
+
if isinstance(shear, (list, tuple)):
|
|
53
|
+
if len(shear) != 2:
|
|
54
|
+
raise TypeError("The length of shear should be 2.")
|
|
55
|
+
for i, _ in enumerate(shear):
|
|
56
|
+
type_check(shear[i], (int, float), "shear[{}]".format(i))
|
|
57
|
+
check_value(shear[i], [-180, 180], "shear[{}]".format(i))
|
|
58
|
+
else:
|
|
59
|
+
check_value(shear, [-180, 180], "shear")
|
|
60
|
+
|
|
61
|
+
type_check(resample, (Inter,), "resample")
|
|
62
|
+
|
|
63
|
+
check_fill_value(fill_value)
|
|
64
|
+
|
|
65
|
+
return method(self, *args, **kwargs)
|
|
66
|
+
|
|
67
|
+
return new_method
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def check_crop_size(size):
|
|
71
|
+
"""Wrapper method to check the parameters of crop size."""
|
|
72
|
+
type_check(size, (int, list, tuple), "size")
|
|
73
|
+
if isinstance(size, int):
|
|
74
|
+
check_value(size, (1, FLOAT_MAX_INTEGER))
|
|
75
|
+
elif isinstance(size, (tuple, list)) and len(size) == 2:
|
|
76
|
+
for index, value in enumerate(size):
|
|
77
|
+
type_check(value, (int,), "size[{}]".format(index))
|
|
78
|
+
check_value(value, (1, FLOAT_MAX_INTEGER))
|
|
79
|
+
else:
|
|
80
|
+
raise TypeError("Size should be a single integer or a list/tuple (h, w) of length 2.")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def check_crop_coordinates(coordinates):
|
|
84
|
+
"""Wrapper method to check the parameters of crop size."""
|
|
85
|
+
type_check(coordinates, (list, tuple), "coordinates")
|
|
86
|
+
if isinstance(coordinates, (tuple, list)) and len(coordinates) == 2:
|
|
87
|
+
for index, value in enumerate(coordinates):
|
|
88
|
+
type_check(value, (int,), "coordinates[{}]".format(index))
|
|
89
|
+
check_value(value, (0, INT32_MAX), "coordinates[{}]".format(index))
|
|
90
|
+
else:
|
|
91
|
+
raise TypeError("Coordinates should be a list/tuple (y, x) of length 2.")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def check_cut_mix_batch_c(method):
|
|
95
|
+
"""Wrapper method to check the parameters of CutMixBatch."""
|
|
96
|
+
|
|
97
|
+
@wraps(method)
|
|
98
|
+
def new_method(self, *args, **kwargs):
|
|
99
|
+
[image_batch_format, alpha, prob], _ = parse_user_args(method, *args, **kwargs)
|
|
100
|
+
type_check(image_batch_format, (ImageBatchFormat,), "image_batch_format")
|
|
101
|
+
type_check(alpha, (int, float), "alpha")
|
|
102
|
+
type_check(prob, (int, float), "prob")
|
|
103
|
+
check_pos_float32(alpha)
|
|
104
|
+
check_positive(alpha, "alpha")
|
|
105
|
+
check_value(prob, [0, 1], "prob")
|
|
106
|
+
return method(self, *args, **kwargs)
|
|
107
|
+
|
|
108
|
+
return new_method
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def check_resize_size(size):
|
|
112
|
+
"""Wrapper method to check the parameters of resize."""
|
|
113
|
+
if isinstance(size, int):
|
|
114
|
+
check_value(size, (1, FLOAT_MAX_INTEGER))
|
|
115
|
+
elif isinstance(size, (tuple, list)) and len(size) == 2:
|
|
116
|
+
for i, value in enumerate(size):
|
|
117
|
+
type_check(value, (int,), "size at dim {0}".format(i))
|
|
118
|
+
check_value(value, (1, INT32_MAX), "size at dim {0}".format(i))
|
|
119
|
+
else:
|
|
120
|
+
raise TypeError("Size should be a single integer or a list/tuple (h, w) of length 2.")
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def check_mix_up_batch_c(method):
|
|
124
|
+
"""Wrapper method to check the parameters of MixUpBatch."""
|
|
125
|
+
|
|
126
|
+
@wraps(method)
|
|
127
|
+
def new_method(self, *args, **kwargs):
|
|
128
|
+
[alpha], _ = parse_user_args(method, *args, **kwargs)
|
|
129
|
+
type_check(alpha, (int, float), "alpha")
|
|
130
|
+
check_positive(alpha, "alpha")
|
|
131
|
+
check_pos_float32(alpha)
|
|
132
|
+
|
|
133
|
+
return method(self, *args, **kwargs)
|
|
134
|
+
|
|
135
|
+
return new_method
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def check_normalize_param(mean, std):
|
|
139
|
+
"""Check the parameters of Normalize and NormalizePad operations."""
|
|
140
|
+
type_check(mean, (list, tuple), "mean")
|
|
141
|
+
type_check(std, (list, tuple), "std")
|
|
142
|
+
if len(mean) != len(std):
|
|
143
|
+
raise ValueError("Length of mean and std must be equal.")
|
|
144
|
+
for i, mean_value in enumerate(mean):
|
|
145
|
+
type_check(mean_value, (int, float), "mean[{}]".format(i))
|
|
146
|
+
check_value(mean_value, [0, 255], "mean[{}]".format(i))
|
|
147
|
+
for j, std_value in enumerate(std):
|
|
148
|
+
type_check(std_value, (int, float), "std[{}]".format(j))
|
|
149
|
+
check_value_normalize_std(std_value, [0, 255], "std[{}]".format(j))
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def check_normalize_c_param(mean, std):
|
|
153
|
+
type_check(mean, (list, tuple), "mean")
|
|
154
|
+
type_check(std, (list, tuple), "std")
|
|
155
|
+
if len(mean) != len(std):
|
|
156
|
+
raise ValueError("Length of mean and std must be equal.")
|
|
157
|
+
for mean_value in mean:
|
|
158
|
+
check_value(mean_value, [0, 255], "mean_value")
|
|
159
|
+
for std_value in std:
|
|
160
|
+
check_value_normalize_std(std_value, [0, 255], "std_value")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def check_normalize_py_param(mean, std):
|
|
164
|
+
type_check(mean, (list, tuple), "mean")
|
|
165
|
+
type_check(std, (list, tuple), "std")
|
|
166
|
+
if len(mean) != len(std):
|
|
167
|
+
raise ValueError("Length of mean and std must be equal.")
|
|
168
|
+
for mean_value in mean:
|
|
169
|
+
check_value(mean_value, [0., 1.], "mean_value")
|
|
170
|
+
for std_value in std:
|
|
171
|
+
check_value_normalize_std(std_value, [0., 1.], "std_value")
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def check_fill_value(fill_value):
|
|
175
|
+
if isinstance(fill_value, int):
|
|
176
|
+
check_uint8(fill_value, "fill_value")
|
|
177
|
+
elif isinstance(fill_value, tuple) and len(fill_value) == 3:
|
|
178
|
+
for i, value in enumerate(fill_value):
|
|
179
|
+
check_uint8(value, "fill_value[{0}]".format(i))
|
|
180
|
+
else:
|
|
181
|
+
raise TypeError("fill_value should be a single integer or a 3-tuple.")
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def check_padding(padding):
|
|
185
|
+
"""Parsing the padding arguments and check if it is legal."""
|
|
186
|
+
type_check(padding, (tuple, list, numbers.Number), "padding")
|
|
187
|
+
if isinstance(padding, numbers.Number):
|
|
188
|
+
type_check(padding, (int,), "padding")
|
|
189
|
+
check_value(padding, (0, INT32_MAX), "padding")
|
|
190
|
+
if isinstance(padding, (tuple, list)):
|
|
191
|
+
if len(padding) not in (2, 4):
|
|
192
|
+
raise ValueError("The size of the padding list or tuple should be 2 or 4.")
|
|
193
|
+
for i, pad_value in enumerate(padding):
|
|
194
|
+
type_check(pad_value, (int,), "padding[{}]".format(i))
|
|
195
|
+
check_value(pad_value, (0, INT32_MAX), "pad_value")
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def check_degrees(degrees):
|
|
199
|
+
"""Check if the `degrees` is legal."""
|
|
200
|
+
type_check(degrees, (int, float, list, tuple), "degrees")
|
|
201
|
+
if isinstance(degrees, (int, float)):
|
|
202
|
+
check_non_negative_float32(degrees, "degrees")
|
|
203
|
+
elif isinstance(degrees, (list, tuple)):
|
|
204
|
+
if len(degrees) == 2:
|
|
205
|
+
type_check_list(degrees, (int, float), "degrees")
|
|
206
|
+
for value in degrees:
|
|
207
|
+
check_float32(value, "degrees")
|
|
208
|
+
if degrees[0] > degrees[1]:
|
|
209
|
+
raise ValueError("degrees should be in (min,max) format. Got (max,min).")
|
|
210
|
+
else:
|
|
211
|
+
raise TypeError("If degrees is a sequence, the length must be 2.")
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def check_random_color_adjust_param(value, input_name, center=1, bound=(0, FLOAT_MAX_INTEGER), non_negative=True):
|
|
215
|
+
"""Check the parameters in random color adjust operation."""
|
|
216
|
+
type_check(value, (numbers.Number, list, tuple), input_name)
|
|
217
|
+
if isinstance(value, numbers.Number):
|
|
218
|
+
if value < 0:
|
|
219
|
+
raise ValueError("The input value of {} cannot be negative.".format(input_name))
|
|
220
|
+
elif isinstance(value, (list, tuple)):
|
|
221
|
+
if len(value) != 2:
|
|
222
|
+
raise TypeError("If {0} is a sequence, the length must be 2.".format(input_name))
|
|
223
|
+
if value[0] > value[1]:
|
|
224
|
+
raise ValueError("{0} value should be in (min,max) format. Got ({1}, {2}).".format(input_name,
|
|
225
|
+
value[0], value[1]))
|
|
226
|
+
check_range(value, bound)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def check_erasing_value(value):
|
|
230
|
+
if not (isinstance(value, (numbers.Number,)) or
|
|
231
|
+
(isinstance(value, (str,)) and value == 'random') or
|
|
232
|
+
(isinstance(value, (tuple, list)) and len(value) == 3)):
|
|
233
|
+
raise ValueError("The value for erasing should be either a single value, "
|
|
234
|
+
"or a string 'random', or a sequence of 3 elements for RGB respectively.")
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def check_crop(method):
|
|
238
|
+
"""A wrapper that wraps a parameter checker around the original function(crop operation)."""
|
|
239
|
+
|
|
240
|
+
@wraps(method)
|
|
241
|
+
def new_method(self, *args, **kwargs):
|
|
242
|
+
[coordinates, size], _ = parse_user_args(method, *args, **kwargs)
|
|
243
|
+
check_crop_coordinates(coordinates)
|
|
244
|
+
check_crop_size(size)
|
|
245
|
+
|
|
246
|
+
return method(self, *args, **kwargs)
|
|
247
|
+
|
|
248
|
+
return new_method
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def check_center_crop(method):
|
|
252
|
+
"""A wrapper that wraps a parameter checker around the original function(center crop operation)."""
|
|
253
|
+
|
|
254
|
+
@wraps(method)
|
|
255
|
+
def new_method(self, *args, **kwargs):
|
|
256
|
+
[size], _ = parse_user_args(method, *args, **kwargs)
|
|
257
|
+
check_crop_size(size)
|
|
258
|
+
|
|
259
|
+
return method(self, *args, **kwargs)
|
|
260
|
+
|
|
261
|
+
return new_method
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def check_five_crop(method):
|
|
265
|
+
"""A wrapper that wraps a parameter checker around the original function(five crop operation)."""
|
|
266
|
+
|
|
267
|
+
@wraps(method)
|
|
268
|
+
def new_method(self, *args, **kwargs):
|
|
269
|
+
[size], _ = parse_user_args(method, *args, **kwargs)
|
|
270
|
+
check_crop_size(size)
|
|
271
|
+
|
|
272
|
+
return method(self, *args, **kwargs)
|
|
273
|
+
|
|
274
|
+
return new_method
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def check_erase(method):
|
|
278
|
+
"""Wrapper method to check the parameters of erase operation."""
|
|
279
|
+
|
|
280
|
+
@wraps(method)
|
|
281
|
+
def new_method(self, *args, **kwargs):
|
|
282
|
+
[top, left, height, width, value, inplace], _ = parse_user_args(
|
|
283
|
+
method, *args, **kwargs)
|
|
284
|
+
check_non_negative_int32(top, "top")
|
|
285
|
+
check_non_negative_int32(left, "left")
|
|
286
|
+
check_pos_int32(height, "height")
|
|
287
|
+
check_pos_int32(width, "width")
|
|
288
|
+
type_check(inplace, (bool,), "inplace")
|
|
289
|
+
type_check(value, (float, int, tuple), "value")
|
|
290
|
+
if isinstance(value, (float, int)):
|
|
291
|
+
value = tuple([value] * 3)
|
|
292
|
+
type_check_list(value, (float, int), "value")
|
|
293
|
+
if isinstance(value, tuple) and len(value) == 3:
|
|
294
|
+
for i, val in enumerate(value):
|
|
295
|
+
check_value(val, (UINT8_MIN, UINT8_MAX), "value[{}]".format(i))
|
|
296
|
+
else:
|
|
297
|
+
raise TypeError("value should be a single integer/float or a 3-tuple.")
|
|
298
|
+
|
|
299
|
+
return method(self, *args, **kwargs)
|
|
300
|
+
|
|
301
|
+
return new_method
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
def check_random_posterize(method):
|
|
305
|
+
"""A wrapper that wraps a parameter checker around the original function(posterize operation)."""
|
|
306
|
+
|
|
307
|
+
@wraps(method)
|
|
308
|
+
def new_method(self, *args, **kwargs):
|
|
309
|
+
[bits], _ = parse_user_args(method, *args, **kwargs)
|
|
310
|
+
if bits is not None:
|
|
311
|
+
type_check(bits, (list, tuple, int), "bits")
|
|
312
|
+
if isinstance(bits, int):
|
|
313
|
+
check_value(bits, [1, 8])
|
|
314
|
+
if isinstance(bits, (list, tuple)):
|
|
315
|
+
if len(bits) != 2:
|
|
316
|
+
raise TypeError("Size of bits should be a single integer or a list/tuple (min, max) of length 2.")
|
|
317
|
+
for item in bits:
|
|
318
|
+
check_uint8(item, "bits")
|
|
319
|
+
# also checks if min <= max
|
|
320
|
+
check_range(bits, [1, 8])
|
|
321
|
+
return method(self, *args, **kwargs)
|
|
322
|
+
|
|
323
|
+
return new_method
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def check_posterize(method):
|
|
327
|
+
"""A wrapper that wraps a parameter checker around the original function(posterize operation)."""
|
|
328
|
+
|
|
329
|
+
@wraps(method)
|
|
330
|
+
def new_method(self, *args, **kwargs):
|
|
331
|
+
[bits], _ = parse_user_args(method, *args, **kwargs)
|
|
332
|
+
type_check(bits, (int,), "bits")
|
|
333
|
+
check_value(bits, [0, 8], "bits")
|
|
334
|
+
return method(self, *args, **kwargs)
|
|
335
|
+
|
|
336
|
+
return new_method
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def check_resize_interpolation(method):
|
|
340
|
+
"""A wrapper that wraps a parameter checker around the original function(resize interpolation operation)."""
|
|
341
|
+
|
|
342
|
+
@wraps(method)
|
|
343
|
+
def new_method(self, *args, **kwargs):
|
|
344
|
+
[size, interpolation], _ = parse_user_args(method, *args, **kwargs)
|
|
345
|
+
if interpolation is None:
|
|
346
|
+
raise KeyError("Interpolation should not be None")
|
|
347
|
+
check_resize_size(size)
|
|
348
|
+
type_check(interpolation, (Inter,), "interpolation")
|
|
349
|
+
|
|
350
|
+
return method(self, *args, **kwargs)
|
|
351
|
+
|
|
352
|
+
return new_method
|
|
353
|
+
|
|
354
|
+
def check_device_target(method):
|
|
355
|
+
"""A wrapper that wraps a parameter checker"""
|
|
356
|
+
|
|
357
|
+
@wraps(method)
|
|
358
|
+
def new_method(self, *args, **kwargs):
|
|
359
|
+
[device_target], _ = parse_user_args(method, *args, **kwargs)
|
|
360
|
+
check_valid_str(device_target, ["CPU", "Ascend"], "device_target")
|
|
361
|
+
check_independent_mode("Transform in Ascend mode", (device_target == "Ascend"))
|
|
362
|
+
return method(self, *args, **kwargs)
|
|
363
|
+
return new_method
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def check_resized_crop(method):
|
|
367
|
+
"""A wrapper that wraps a parameter checker around the original function(ResizedCrop operation)."""
|
|
368
|
+
|
|
369
|
+
@wraps(method)
|
|
370
|
+
def new_method(self, *args, **kwargs):
|
|
371
|
+
[top, left, height, width, size, interpolation], _ = parse_user_args(method, *args, **kwargs)
|
|
372
|
+
check_non_negative_int32(top, "top")
|
|
373
|
+
check_non_negative_int32(left, "left")
|
|
374
|
+
check_pos_int32(height, "height")
|
|
375
|
+
check_pos_int32(width, "width")
|
|
376
|
+
type_check(interpolation, (Inter,), "interpolation")
|
|
377
|
+
check_crop_size(size)
|
|
378
|
+
|
|
379
|
+
return method(self, *args, **kwargs)
|
|
380
|
+
return new_method
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
def check_resize(method):
|
|
384
|
+
"""A wrapper that wraps a parameter checker around the original function(resize operation)."""
|
|
385
|
+
|
|
386
|
+
@wraps(method)
|
|
387
|
+
def new_method(self, *args, **kwargs):
|
|
388
|
+
[size], _ = parse_user_args(method, *args, **kwargs)
|
|
389
|
+
check_resize_size(size)
|
|
390
|
+
|
|
391
|
+
return method(self, *args, **kwargs)
|
|
392
|
+
|
|
393
|
+
return new_method
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def check_size_scale_ration_max_attempts_paras(size, scale, ratio, max_attempts):
|
|
397
|
+
"""Wrapper method to check the parameters of RandomCropDecodeResize."""
|
|
398
|
+
|
|
399
|
+
check_crop_size(size)
|
|
400
|
+
if scale is not None:
|
|
401
|
+
type_check(scale, (tuple, list), "scale")
|
|
402
|
+
if len(scale) != 2:
|
|
403
|
+
raise TypeError("scale should be a list/tuple of length 2.")
|
|
404
|
+
type_check_list(scale, (float, int), "scale")
|
|
405
|
+
if scale[0] > scale[1]:
|
|
406
|
+
raise ValueError("scale should be in (min,max) format. Got (max,min).")
|
|
407
|
+
check_range(scale, [0, FLOAT_MAX_INTEGER])
|
|
408
|
+
check_positive(scale[1], "scale[1]")
|
|
409
|
+
if ratio is not None:
|
|
410
|
+
type_check(ratio, (tuple, list), "ratio")
|
|
411
|
+
if len(ratio) != 2:
|
|
412
|
+
raise TypeError("ratio should be a list/tuple of length 2.")
|
|
413
|
+
check_pos_float32(ratio[0], "ratio[0]")
|
|
414
|
+
check_pos_float32(ratio[1], "ratio[1]")
|
|
415
|
+
if ratio[0] > ratio[1]:
|
|
416
|
+
raise ValueError("ratio should be in (min,max) format. Got (max,min).")
|
|
417
|
+
if max_attempts is not None:
|
|
418
|
+
check_pos_int32(max_attempts, "max_attempts")
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
def check_random_adjust_sharpness(method):
|
|
422
|
+
"""Wrapper method to check the parameters of RandomAdjustSharpness."""
|
|
423
|
+
|
|
424
|
+
@wraps(method)
|
|
425
|
+
def new_method(self, *args, **kwargs):
|
|
426
|
+
[degree, prob], _ = parse_user_args(method, *args, **kwargs)
|
|
427
|
+
type_check(degree, (float, int), "degree")
|
|
428
|
+
check_non_negative_float32(degree, "degree")
|
|
429
|
+
type_check(prob, (float, int), "prob")
|
|
430
|
+
check_value(prob, [0., 1.], "prob")
|
|
431
|
+
|
|
432
|
+
return method(self, *args, **kwargs)
|
|
433
|
+
|
|
434
|
+
return new_method
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
def check_random_resize_crop(method):
|
|
438
|
+
"""A wrapper that wraps a parameter checker around the original function(random resize crop operation)."""
|
|
439
|
+
|
|
440
|
+
@wraps(method)
|
|
441
|
+
def new_method(self, *args, **kwargs):
|
|
442
|
+
[size, scale, ratio, interpolation, max_attempts], _ = parse_user_args(method, *args, **kwargs)
|
|
443
|
+
if interpolation is not None:
|
|
444
|
+
type_check(interpolation, (Inter,), "interpolation")
|
|
445
|
+
check_size_scale_ration_max_attempts_paras(size, scale, ratio, max_attempts)
|
|
446
|
+
|
|
447
|
+
return method(self, *args, **kwargs)
|
|
448
|
+
|
|
449
|
+
return new_method
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
def check_random_auto_contrast(method):
|
|
453
|
+
"""Wrapper method to check the parameters of Python RandomAutoContrast op."""
|
|
454
|
+
|
|
455
|
+
@wraps(method)
|
|
456
|
+
def new_method(self, *args, **kwargs):
|
|
457
|
+
[cutoff, ignore, prob], _ = parse_user_args(method, *args, **kwargs)
|
|
458
|
+
type_check(cutoff, (int, float), "cutoff")
|
|
459
|
+
check_value_cutoff(cutoff, [0, 50], "cutoff")
|
|
460
|
+
if ignore is not None:
|
|
461
|
+
type_check(ignore, (list, tuple, int), "ignore")
|
|
462
|
+
if isinstance(ignore, int):
|
|
463
|
+
check_value(ignore, [0, 255], "ignore")
|
|
464
|
+
if isinstance(ignore, (list, tuple)):
|
|
465
|
+
for item in ignore:
|
|
466
|
+
type_check(item, (int,), "item")
|
|
467
|
+
check_value(item, [0, 255], "ignore")
|
|
468
|
+
type_check(prob, (float, int,), "prob")
|
|
469
|
+
check_value(prob, [0., 1.], "prob")
|
|
470
|
+
|
|
471
|
+
return method(self, *args, **kwargs)
|
|
472
|
+
|
|
473
|
+
return new_method
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
def check_prob(method):
|
|
477
|
+
"""A wrapper that wraps a parameter checker (to confirm probability) around the original function."""
|
|
478
|
+
|
|
479
|
+
@wraps(method)
|
|
480
|
+
def new_method(self, *args, **kwargs):
|
|
481
|
+
[prob], _ = parse_user_args(method, *args, **kwargs)
|
|
482
|
+
type_check(prob, (float, int,), "prob")
|
|
483
|
+
check_value(prob, [0., 1.], "prob")
|
|
484
|
+
|
|
485
|
+
return method(self, *args, **kwargs)
|
|
486
|
+
|
|
487
|
+
return new_method
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
def check_alpha(method):
|
|
491
|
+
"""A wrapper method to check alpha parameter in RandomLighting."""
|
|
492
|
+
|
|
493
|
+
@wraps(method)
|
|
494
|
+
def new_method(self, *args, **kwargs):
|
|
495
|
+
[alpha], _ = parse_user_args(method, *args, **kwargs)
|
|
496
|
+
type_check(alpha, (float, int,), "alpha")
|
|
497
|
+
check_non_negative_float32(alpha, "alpha")
|
|
498
|
+
|
|
499
|
+
return method(self, *args, **kwargs)
|
|
500
|
+
|
|
501
|
+
return new_method
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
def check_normalize(method):
|
|
505
|
+
"""A wrapper that wraps a parameter checker around the original function."""
|
|
506
|
+
|
|
507
|
+
@wraps(method)
|
|
508
|
+
def new_method(self, *args, **kwargs):
|
|
509
|
+
[mean, std, is_hwc], _ = parse_user_args(method, *args, **kwargs)
|
|
510
|
+
check_normalize_param(mean, std)
|
|
511
|
+
type_check(is_hwc, (bool,), "is_hwc")
|
|
512
|
+
return method(self, *args, **kwargs)
|
|
513
|
+
|
|
514
|
+
return new_method
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
def check_normalize_py(method):
|
|
518
|
+
"""A wrapper that wraps a parameter checker around the original function(normalize operation written in Python)."""
|
|
519
|
+
|
|
520
|
+
@wraps(method)
|
|
521
|
+
def new_method(self, *args, **kwargs):
|
|
522
|
+
[mean, std], _ = parse_user_args(method, *args, **kwargs)
|
|
523
|
+
check_normalize_py_param(mean, std)
|
|
524
|
+
|
|
525
|
+
return method(self, *args, **kwargs)
|
|
526
|
+
|
|
527
|
+
return new_method
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
def check_normalize_c(method):
|
|
531
|
+
"""A wrapper that wraps a parameter checker around the original function(normalize operation written in C++)."""
|
|
532
|
+
|
|
533
|
+
@wraps(method)
|
|
534
|
+
def new_method(self, *args, **kwargs):
|
|
535
|
+
[mean, std], _ = parse_user_args(method, *args, **kwargs)
|
|
536
|
+
check_normalize_c_param(mean, std)
|
|
537
|
+
|
|
538
|
+
return method(self, *args, **kwargs)
|
|
539
|
+
|
|
540
|
+
return new_method
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
def check_normalizepad(method):
|
|
544
|
+
"""A wrapper that wraps a parameter checker around the original function."""
|
|
545
|
+
|
|
546
|
+
@wraps(method)
|
|
547
|
+
def new_method(self, *args, **kwargs):
|
|
548
|
+
[mean, std, dtype, is_hwc], _ = parse_user_args(method, *args, **kwargs)
|
|
549
|
+
check_normalize_param(mean, std)
|
|
550
|
+
type_check(is_hwc, (bool,), "is_hwc")
|
|
551
|
+
if not isinstance(dtype, str):
|
|
552
|
+
raise TypeError("dtype should be string.")
|
|
553
|
+
if dtype not in ["float32", "float16"]:
|
|
554
|
+
raise ValueError("dtype only supports float32 or float16.")
|
|
555
|
+
|
|
556
|
+
return method(self, *args, **kwargs)
|
|
557
|
+
|
|
558
|
+
return new_method
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
def check_normalizepad_c(method):
|
|
562
|
+
"""A wrapper that wraps a parameter checker around the original function(normalizepad written in C++)."""
|
|
563
|
+
|
|
564
|
+
@wraps(method)
|
|
565
|
+
def new_method(self, *args, **kwargs):
|
|
566
|
+
[mean, std, dtype], _ = parse_user_args(method, *args, **kwargs)
|
|
567
|
+
check_normalize_c_param(mean, std)
|
|
568
|
+
if not isinstance(dtype, str):
|
|
569
|
+
raise TypeError("dtype should be string.")
|
|
570
|
+
if dtype not in ["float32", "float16"]:
|
|
571
|
+
raise ValueError("dtype only support float32 or float16.")
|
|
572
|
+
|
|
573
|
+
return method(self, *args, **kwargs)
|
|
574
|
+
|
|
575
|
+
return new_method
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
def check_normalizepad_py(method):
|
|
579
|
+
"""A wrapper that wraps a parameter checker around the original function(normalizepad written in Python)."""
|
|
580
|
+
|
|
581
|
+
@wraps(method)
|
|
582
|
+
def new_method(self, *args, **kwargs):
|
|
583
|
+
[mean, std, dtype], _ = parse_user_args(method, *args, **kwargs)
|
|
584
|
+
check_normalize_py_param(mean, std)
|
|
585
|
+
if not isinstance(dtype, str):
|
|
586
|
+
raise TypeError("dtype should be string.")
|
|
587
|
+
if dtype not in ["float32", "float16"]:
|
|
588
|
+
raise ValueError("dtype only support float32 or float16.")
|
|
589
|
+
|
|
590
|
+
return method(self, *args, **kwargs)
|
|
591
|
+
|
|
592
|
+
return new_method
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
def check_random_crop(method):
|
|
596
|
+
"""Wrapper method to check the parameters of random crop."""
|
|
597
|
+
|
|
598
|
+
@wraps(method)
|
|
599
|
+
def new_method(self, *args, **kwargs):
|
|
600
|
+
[size, padding, pad_if_needed, fill_value, padding_mode], _ = parse_user_args(method, *args, **kwargs)
|
|
601
|
+
check_crop_size(size)
|
|
602
|
+
type_check(pad_if_needed, (bool,), "pad_if_needed")
|
|
603
|
+
if padding is not None:
|
|
604
|
+
check_padding(padding)
|
|
605
|
+
if fill_value is not None:
|
|
606
|
+
check_fill_value(fill_value)
|
|
607
|
+
if padding_mode is not None:
|
|
608
|
+
type_check(padding_mode, (Border,), "padding_mode")
|
|
609
|
+
|
|
610
|
+
return method(self, *args, **kwargs)
|
|
611
|
+
|
|
612
|
+
return new_method
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
def check_random_color_adjust(method):
|
|
616
|
+
"""Wrapper method to check the parameters of random color adjust."""
|
|
617
|
+
|
|
618
|
+
@wraps(method)
|
|
619
|
+
def new_method(self, *args, **kwargs):
|
|
620
|
+
[brightness, contrast, saturation, hue], _ = parse_user_args(method, *args, **kwargs)
|
|
621
|
+
check_random_color_adjust_param(brightness, "brightness")
|
|
622
|
+
check_random_color_adjust_param(contrast, "contrast")
|
|
623
|
+
check_random_color_adjust_param(saturation, "saturation")
|
|
624
|
+
check_random_color_adjust_param(hue, 'hue', center=0, bound=(-0.5, 0.5), non_negative=False)
|
|
625
|
+
|
|
626
|
+
return method(self, *args, **kwargs)
|
|
627
|
+
|
|
628
|
+
return new_method
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
def check_resample_expand_center_fill_value_params(resample, expand, center, fill_value):
|
|
632
|
+
type_check(resample, (Inter,), "resample")
|
|
633
|
+
type_check(expand, (bool,), "expand")
|
|
634
|
+
if center is not None:
|
|
635
|
+
check_2tuple(center, "center")
|
|
636
|
+
for value in center:
|
|
637
|
+
type_check(value, (int, float), "center")
|
|
638
|
+
check_value(value, [INT32_MIN, INT32_MAX], "center")
|
|
639
|
+
check_fill_value(fill_value)
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
def check_random_rotation(method):
|
|
643
|
+
"""Wrapper method to check the parameters of random rotation."""
|
|
644
|
+
|
|
645
|
+
@wraps(method)
|
|
646
|
+
def new_method(self, *args, **kwargs):
|
|
647
|
+
[degrees, resample, expand, center, fill_value], _ = parse_user_args(method, *args, **kwargs)
|
|
648
|
+
check_degrees(degrees)
|
|
649
|
+
check_resample_expand_center_fill_value_params(resample, expand, center, fill_value)
|
|
650
|
+
|
|
651
|
+
return method(self, *args, **kwargs)
|
|
652
|
+
|
|
653
|
+
return new_method
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
def check_rotate(method):
|
|
657
|
+
"""Wrapper method to check the parameters of rotate."""
|
|
658
|
+
|
|
659
|
+
@wraps(method)
|
|
660
|
+
def new_method(self, *args, **kwargs):
|
|
661
|
+
[degrees, resample, expand, center, fill_value], _ = parse_user_args(method, *args, **kwargs)
|
|
662
|
+
type_check(degrees, (float, int), "degrees")
|
|
663
|
+
check_float32(degrees, "degrees")
|
|
664
|
+
check_resample_expand_center_fill_value_params(resample, expand, center, fill_value)
|
|
665
|
+
|
|
666
|
+
return method(self, *args, **kwargs)
|
|
667
|
+
|
|
668
|
+
return new_method
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
def check_ten_crop(method):
|
|
672
|
+
"""Wrapper method to check the parameters of crop."""
|
|
673
|
+
|
|
674
|
+
@wraps(method)
|
|
675
|
+
def new_method(self, *args, **kwargs):
|
|
676
|
+
[size, use_vertical_flip], _ = parse_user_args(method, *args, **kwargs)
|
|
677
|
+
check_crop_size(size)
|
|
678
|
+
|
|
679
|
+
if use_vertical_flip is not None:
|
|
680
|
+
type_check(use_vertical_flip, (bool,), "use_vertical_flip")
|
|
681
|
+
|
|
682
|
+
return method(self, *args, **kwargs)
|
|
683
|
+
|
|
684
|
+
return new_method
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
def check_num_channels(method):
|
|
688
|
+
"""Wrapper method to check the parameters of number of channels."""
|
|
689
|
+
|
|
690
|
+
@wraps(method)
|
|
691
|
+
def new_method(self, *args, **kwargs):
|
|
692
|
+
[num_output_channels], _ = parse_user_args(method, *args, **kwargs)
|
|
693
|
+
type_check(num_output_channels, (int,), "num_output_channels")
|
|
694
|
+
if num_output_channels not in (1, 3):
|
|
695
|
+
raise ValueError("Number of channels of the output grayscale image"
|
|
696
|
+
"should be either 1 or 3. Got {0}.".format(num_output_channels))
|
|
697
|
+
|
|
698
|
+
return method(self, *args, **kwargs)
|
|
699
|
+
|
|
700
|
+
return new_method
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
def check_pad(method):
|
|
704
|
+
"""Wrapper method to check the parameters of random pad."""
|
|
705
|
+
|
|
706
|
+
@wraps(method)
|
|
707
|
+
def new_method(self, *args, **kwargs):
|
|
708
|
+
[padding, fill_value, padding_mode], _ = parse_user_args(method, *args, **kwargs)
|
|
709
|
+
check_padding(padding)
|
|
710
|
+
check_fill_value(fill_value)
|
|
711
|
+
type_check(padding_mode, (Border,), "padding_mode")
|
|
712
|
+
|
|
713
|
+
return method(self, *args, **kwargs)
|
|
714
|
+
|
|
715
|
+
return new_method
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
def check_pad_to_size(method):
|
|
719
|
+
"""Wrapper method to check the parameters of PadToSize."""
|
|
720
|
+
|
|
721
|
+
@wraps(method)
|
|
722
|
+
def new_method(self, *args, **kwargs):
|
|
723
|
+
[size, offset, fill_value, padding_mode], _ = parse_user_args(method, *args, **kwargs)
|
|
724
|
+
|
|
725
|
+
type_check(size, (int, list, tuple), "size")
|
|
726
|
+
if isinstance(size, int):
|
|
727
|
+
check_pos_int32(size, "size")
|
|
728
|
+
else:
|
|
729
|
+
if len(size) != 2:
|
|
730
|
+
raise ValueError("The size must be a sequence of length 2.")
|
|
731
|
+
for i, value in enumerate(size):
|
|
732
|
+
check_pos_int32(value, "size{0}".format(i))
|
|
733
|
+
|
|
734
|
+
if offset is not None:
|
|
735
|
+
type_check(offset, (int, list, tuple), "offset")
|
|
736
|
+
if isinstance(offset, int):
|
|
737
|
+
check_non_negative_int32(offset, "offset")
|
|
738
|
+
else:
|
|
739
|
+
if len(offset) not in [0, 2]:
|
|
740
|
+
raise ValueError("The offset must be empty or a sequence of length 2.")
|
|
741
|
+
for i, _ in enumerate(offset):
|
|
742
|
+
check_non_negative_int32(offset[i], "offset{0}".format(i))
|
|
743
|
+
|
|
744
|
+
check_fill_value(fill_value)
|
|
745
|
+
type_check(padding_mode, (Border,), "padding_mode")
|
|
746
|
+
|
|
747
|
+
return method(self, *args, **kwargs)
|
|
748
|
+
|
|
749
|
+
return new_method
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
def check_perspective(method):
|
|
753
|
+
"""Wrapper method to check the parameters of Perspective."""
|
|
754
|
+
|
|
755
|
+
@wraps(method)
|
|
756
|
+
def new_method(self, *args, **kwargs):
|
|
757
|
+
[start_points, end_points, interpolation], _ = parse_user_args(method, *args, **kwargs)
|
|
758
|
+
|
|
759
|
+
type_check_list(start_points, (list, tuple), "start_points")
|
|
760
|
+
type_check_list(end_points, (list, tuple), "end_points")
|
|
761
|
+
|
|
762
|
+
if len(start_points) != 4:
|
|
763
|
+
raise TypeError("start_points should be a list or tuple of length 4.")
|
|
764
|
+
for i, element in enumerate(start_points):
|
|
765
|
+
type_check(element, (list, tuple), "start_points[{}]".format(i))
|
|
766
|
+
if len(start_points[i]) != 2:
|
|
767
|
+
raise TypeError("start_points[{}] should be a list or tuple of length 2.".format(i))
|
|
768
|
+
check_int32(element[0], "start_points[{}][0]".format(i))
|
|
769
|
+
check_int32(element[1], "start_points[{}][1]".format(i))
|
|
770
|
+
if len(end_points) != 4:
|
|
771
|
+
raise TypeError("end_points should be a list or tuple of length 4.")
|
|
772
|
+
for i, element in enumerate(end_points):
|
|
773
|
+
type_check(element, (list, tuple), "end_points[{}]".format(i))
|
|
774
|
+
if len(end_points[i]) != 2:
|
|
775
|
+
raise TypeError("end_points[{}] should be a list or tuple of length 2.".format(i))
|
|
776
|
+
check_int32(element[0], "end_points[{}][0]".format(i))
|
|
777
|
+
check_int32(element[1], "end_points[{}][1]".format(i))
|
|
778
|
+
|
|
779
|
+
type_check(interpolation, (Inter,), "interpolation")
|
|
780
|
+
|
|
781
|
+
return method(self, *args, **kwargs)
|
|
782
|
+
|
|
783
|
+
return new_method
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
def check_slice_patches(method):
|
|
787
|
+
"""Wrapper method to check the parameters of slice patches."""
|
|
788
|
+
|
|
789
|
+
@wraps(method)
|
|
790
|
+
def new_method(self, *args, **kwargs):
|
|
791
|
+
[num_height, num_width, slice_mode, fill_value], _ = parse_user_args(method, *args, **kwargs)
|
|
792
|
+
if num_height is not None:
|
|
793
|
+
type_check(num_height, (int,), "num_height")
|
|
794
|
+
check_value(num_height, (1, INT32_MAX), "num_height")
|
|
795
|
+
if num_width is not None:
|
|
796
|
+
type_check(num_width, (int,), "num_width")
|
|
797
|
+
check_value(num_width, (1, INT32_MAX), "num_width")
|
|
798
|
+
if slice_mode is not None:
|
|
799
|
+
type_check(slice_mode, (SliceMode,), "slice_mode")
|
|
800
|
+
if fill_value is not None:
|
|
801
|
+
type_check(fill_value, (int,), "fill_value")
|
|
802
|
+
check_value(fill_value, [0, 255], "fill_value")
|
|
803
|
+
return method(self, *args, **kwargs)
|
|
804
|
+
|
|
805
|
+
return new_method
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
def check_random_perspective(method):
|
|
809
|
+
"""Wrapper method to check the parameters of random perspective."""
|
|
810
|
+
|
|
811
|
+
@wraps(method)
|
|
812
|
+
def new_method(self, *args, **kwargs):
|
|
813
|
+
[distortion_scale, prob, interpolation], _ = parse_user_args(method, *args, **kwargs)
|
|
814
|
+
|
|
815
|
+
type_check(distortion_scale, (float,), "distortion_scale")
|
|
816
|
+
type_check(prob, (float,), "prob")
|
|
817
|
+
check_value(distortion_scale, [0., 1.], "distortion_scale")
|
|
818
|
+
check_value(prob, [0., 1.], "prob")
|
|
819
|
+
type_check(interpolation, (Inter,), "interpolation")
|
|
820
|
+
|
|
821
|
+
return method(self, *args, **kwargs)
|
|
822
|
+
|
|
823
|
+
return new_method
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
def check_mix_up(method):
|
|
827
|
+
"""Wrapper method to check the parameters of mix up."""
|
|
828
|
+
|
|
829
|
+
@wraps(method)
|
|
830
|
+
def new_method(self, *args, **kwargs):
|
|
831
|
+
[batch_size, alpha, is_single], _ = parse_user_args(method, *args, **kwargs)
|
|
832
|
+
type_check(is_single, (bool,), "is_single")
|
|
833
|
+
type_check(batch_size, (int,), "batch_size")
|
|
834
|
+
type_check(alpha, (int, float), "alpha")
|
|
835
|
+
check_value(batch_size, (1, FLOAT_MAX_INTEGER))
|
|
836
|
+
check_positive(alpha, "alpha")
|
|
837
|
+
return method(self, *args, **kwargs)
|
|
838
|
+
|
|
839
|
+
return new_method
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
def check_rgb_to_bgr(method):
|
|
843
|
+
"""Wrapper method to check the parameters of rgb_to_bgr."""
|
|
844
|
+
|
|
845
|
+
@wraps(method)
|
|
846
|
+
def new_method(self, *args, **kwargs):
|
|
847
|
+
[is_hwc], _ = parse_user_args(method, *args, **kwargs)
|
|
848
|
+
type_check(is_hwc, (bool,), "is_hwc")
|
|
849
|
+
return method(self, *args, **kwargs)
|
|
850
|
+
|
|
851
|
+
return new_method
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
def check_rgb_to_hsv(method):
|
|
855
|
+
"""Wrapper method to check the parameters of rgb_to_hsv."""
|
|
856
|
+
|
|
857
|
+
@wraps(method)
|
|
858
|
+
def new_method(self, *args, **kwargs):
|
|
859
|
+
[is_hwc], _ = parse_user_args(method, *args, **kwargs)
|
|
860
|
+
type_check(is_hwc, (bool,), "is_hwc")
|
|
861
|
+
return method(self, *args, **kwargs)
|
|
862
|
+
|
|
863
|
+
return new_method
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
def check_hsv_to_rgb(method):
|
|
867
|
+
"""Wrapper method to check the parameters of hsv_to_rgb."""
|
|
868
|
+
|
|
869
|
+
@wraps(method)
|
|
870
|
+
def new_method(self, *args, **kwargs):
|
|
871
|
+
[is_hwc], _ = parse_user_args(method, *args, **kwargs)
|
|
872
|
+
type_check(is_hwc, (bool,), "is_hwc")
|
|
873
|
+
return method(self, *args, **kwargs)
|
|
874
|
+
|
|
875
|
+
return new_method
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
def check_random_erasing(method):
|
|
879
|
+
"""Wrapper method to check the parameters of random erasing."""
|
|
880
|
+
|
|
881
|
+
@wraps(method)
|
|
882
|
+
def new_method(self, *args, **kwargs):
|
|
883
|
+
[prob, scale, ratio, value, inplace, max_attempts], _ = parse_user_args(method, *args, **kwargs)
|
|
884
|
+
|
|
885
|
+
type_check(prob, (float, int,), "prob")
|
|
886
|
+
type_check_list(scale, (float, int,), "scale")
|
|
887
|
+
if len(scale) != 2:
|
|
888
|
+
raise TypeError("scale should be a list or tuple of length 2.")
|
|
889
|
+
type_check_list(ratio, (float, int,), "ratio")
|
|
890
|
+
if len(ratio) != 2:
|
|
891
|
+
raise TypeError("ratio should be a list or tuple of length 2.")
|
|
892
|
+
type_check(value, (int, list, tuple, str), "value")
|
|
893
|
+
type_check(inplace, (bool,), "inplace")
|
|
894
|
+
type_check(max_attempts, (int,), "max_attempts")
|
|
895
|
+
check_erasing_value(value)
|
|
896
|
+
|
|
897
|
+
check_value(prob, [0., 1.], "prob")
|
|
898
|
+
if scale[0] > scale[1]:
|
|
899
|
+
raise ValueError("scale should be in (min,max) format. Got (max,min).")
|
|
900
|
+
check_range(scale, [0, FLOAT_MAX_INTEGER])
|
|
901
|
+
check_positive(scale[1], "scale[1]")
|
|
902
|
+
if ratio[0] > ratio[1]:
|
|
903
|
+
raise ValueError("ratio should be in (min,max) format. Got (max,min).")
|
|
904
|
+
check_value_ratio(ratio[0], [0, FLOAT_MAX_INTEGER])
|
|
905
|
+
check_value_ratio(ratio[1], [0, FLOAT_MAX_INTEGER])
|
|
906
|
+
if isinstance(value, int):
|
|
907
|
+
check_value(value, (0, 255))
|
|
908
|
+
if isinstance(value, (list, tuple)):
|
|
909
|
+
for item in value:
|
|
910
|
+
type_check(item, (int,), "value")
|
|
911
|
+
check_value(item, [0, 255], "value")
|
|
912
|
+
check_value(max_attempts, (1, FLOAT_MAX_INTEGER))
|
|
913
|
+
|
|
914
|
+
return method(self, *args, **kwargs)
|
|
915
|
+
|
|
916
|
+
return new_method
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
def check_cutout_new(method):
|
|
920
|
+
"""Wrapper method to check the parameters of cutout operation."""
|
|
921
|
+
|
|
922
|
+
@wraps(method)
|
|
923
|
+
def new_method(self, *args, **kwargs):
|
|
924
|
+
[length, num_patches, is_hwc], _ = parse_user_args(method, *args, **kwargs)
|
|
925
|
+
type_check(length, (int,), "length")
|
|
926
|
+
type_check(num_patches, (int,), "num_patches")
|
|
927
|
+
type_check(is_hwc, (bool,), "is_hwc")
|
|
928
|
+
check_value(length, (1, FLOAT_MAX_INTEGER))
|
|
929
|
+
check_value(num_patches, (1, FLOAT_MAX_INTEGER))
|
|
930
|
+
|
|
931
|
+
return method(self, *args, **kwargs)
|
|
932
|
+
|
|
933
|
+
return new_method
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
def check_cutout(method):
|
|
937
|
+
"""Wrapper method to check the parameters of cutout operation."""
|
|
938
|
+
|
|
939
|
+
@wraps(method)
|
|
940
|
+
def new_method(self, *args, **kwargs):
|
|
941
|
+
[length, num_patches], _ = parse_user_args(method, *args, **kwargs)
|
|
942
|
+
type_check(length, (int,), "length")
|
|
943
|
+
type_check(num_patches, (int,), "num_patches")
|
|
944
|
+
check_value(length, (1, FLOAT_MAX_INTEGER))
|
|
945
|
+
check_value(num_patches, (1, FLOAT_MAX_INTEGER))
|
|
946
|
+
|
|
947
|
+
return method(self, *args, **kwargs)
|
|
948
|
+
|
|
949
|
+
return new_method
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
def check_decode(method):
|
|
953
|
+
"""Wrapper method to check the parameters of decode operation."""
|
|
954
|
+
|
|
955
|
+
@wraps(method)
|
|
956
|
+
def new_method(self, *args, **kwargs):
|
|
957
|
+
[to_pil], _ = parse_user_args(method, *args, **kwargs)
|
|
958
|
+
type_check(to_pil, (bool,), "to_pil")
|
|
959
|
+
|
|
960
|
+
return method(self, *args, **kwargs)
|
|
961
|
+
|
|
962
|
+
return new_method
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
def check_linear_transform(method):
|
|
966
|
+
"""Wrapper method to check the parameters of linear transform."""
|
|
967
|
+
|
|
968
|
+
@wraps(method)
|
|
969
|
+
def new_method(self, *args, **kwargs):
|
|
970
|
+
[transformation_matrix, mean_vector], _ = parse_user_args(method, *args, **kwargs)
|
|
971
|
+
type_check(transformation_matrix, (np.ndarray,), "transformation_matrix")
|
|
972
|
+
type_check(mean_vector, (np.ndarray,), "mean_vector")
|
|
973
|
+
|
|
974
|
+
if transformation_matrix.shape[0] != transformation_matrix.shape[1]:
|
|
975
|
+
raise ValueError("transformation_matrix should be a square matrix. "
|
|
976
|
+
"Got shape {} instead.".format(transformation_matrix.shape))
|
|
977
|
+
if mean_vector.shape[0] != transformation_matrix.shape[0]:
|
|
978
|
+
raise ValueError("mean_vector length {0} should match either one dimension of the square"
|
|
979
|
+
"transformation_matrix {1}.".format(mean_vector.shape[0], transformation_matrix.shape))
|
|
980
|
+
|
|
981
|
+
return method(self, *args, **kwargs)
|
|
982
|
+
|
|
983
|
+
return new_method
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
def check_random_affine(method):
|
|
987
|
+
"""Wrapper method to check the parameters of random affine."""
|
|
988
|
+
|
|
989
|
+
@wraps(method)
|
|
990
|
+
def new_method(self, *args, **kwargs):
|
|
991
|
+
[degrees, translate, scale, shear, resample, fill_value], _ = parse_user_args(method, *args, **kwargs)
|
|
992
|
+
check_degrees(degrees)
|
|
993
|
+
|
|
994
|
+
if translate is not None:
|
|
995
|
+
type_check(translate, (list, tuple), "translate")
|
|
996
|
+
type_check_list(translate, (int, float), "translate")
|
|
997
|
+
if len(translate) != 2 and len(translate) != 4:
|
|
998
|
+
raise TypeError("translate should be a list or tuple of length 2 or 4.")
|
|
999
|
+
for i, t in enumerate(translate):
|
|
1000
|
+
check_value(t, [-1.0, 1.0], "translate at {0}".format(i))
|
|
1001
|
+
|
|
1002
|
+
if scale is not None:
|
|
1003
|
+
type_check(scale, (tuple, list), "scale")
|
|
1004
|
+
type_check_list(scale, (int, float), "scale")
|
|
1005
|
+
if len(scale) == 2:
|
|
1006
|
+
if scale[0] > scale[1]:
|
|
1007
|
+
raise ValueError("Input scale[1] must be equal to or greater than scale[0].")
|
|
1008
|
+
check_range(scale, [0, FLOAT_MAX_INTEGER])
|
|
1009
|
+
check_positive(scale[1], "scale[1]")
|
|
1010
|
+
else:
|
|
1011
|
+
raise TypeError("scale should be a list or tuple of length 2.")
|
|
1012
|
+
|
|
1013
|
+
if shear is not None:
|
|
1014
|
+
type_check(shear, (numbers.Number, tuple, list), "shear")
|
|
1015
|
+
if isinstance(shear, numbers.Number):
|
|
1016
|
+
check_positive(shear, "shear")
|
|
1017
|
+
else:
|
|
1018
|
+
type_check_list(shear, (int, float), "shear")
|
|
1019
|
+
if len(shear) not in (2, 4):
|
|
1020
|
+
raise TypeError("shear must be of length 2 or 4.")
|
|
1021
|
+
if len(shear) == 2 and shear[0] > shear[1]:
|
|
1022
|
+
raise ValueError("Input shear[1] must be equal to or greater than shear[0]")
|
|
1023
|
+
if len(shear) == 4 and (shear[0] > shear[1] or shear[2] > shear[3]):
|
|
1024
|
+
raise ValueError("Input shear[1] must be equal to or greater than shear[0] and "
|
|
1025
|
+
"shear[3] must be equal to or greater than shear[2].")
|
|
1026
|
+
|
|
1027
|
+
type_check(resample, (Inter,), "resample")
|
|
1028
|
+
|
|
1029
|
+
if fill_value is not None:
|
|
1030
|
+
check_fill_value(fill_value)
|
|
1031
|
+
|
|
1032
|
+
return method(self, *args, **kwargs)
|
|
1033
|
+
|
|
1034
|
+
return new_method
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
def check_rescale(method):
|
|
1038
|
+
"""Wrapper method to check the parameters of rescale."""
|
|
1039
|
+
|
|
1040
|
+
@wraps(method)
|
|
1041
|
+
def new_method(self, *args, **kwargs):
|
|
1042
|
+
[rescale, shift], _ = parse_user_args(method, *args, **kwargs)
|
|
1043
|
+
type_check(rescale, (numbers.Number,), "rescale")
|
|
1044
|
+
type_check(shift, (numbers.Number,), "shift")
|
|
1045
|
+
check_float32(rescale, "rescale")
|
|
1046
|
+
check_float32(shift, "shift")
|
|
1047
|
+
|
|
1048
|
+
return method(self, *args, **kwargs)
|
|
1049
|
+
|
|
1050
|
+
return new_method
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
def check_uniform_augment_cpp(method):
|
|
1054
|
+
"""Wrapper method to check the parameters of UniformAugment C++ op."""
|
|
1055
|
+
|
|
1056
|
+
@wraps(method)
|
|
1057
|
+
def new_method(self, *args, **kwargs):
|
|
1058
|
+
[transforms, num_ops], _ = parse_user_args(method, *args, **kwargs)
|
|
1059
|
+
type_check(num_ops, (int,), "num_ops")
|
|
1060
|
+
check_positive(num_ops, "num_ops")
|
|
1061
|
+
|
|
1062
|
+
if num_ops > len(transforms):
|
|
1063
|
+
raise ValueError("num_ops is greater than transforms list size.")
|
|
1064
|
+
parsed_transforms = []
|
|
1065
|
+
for op in transforms:
|
|
1066
|
+
if op and getattr(op, 'parse', None):
|
|
1067
|
+
parsed_transforms.append(op.parse())
|
|
1068
|
+
else:
|
|
1069
|
+
parsed_transforms.append(op)
|
|
1070
|
+
type_check(parsed_transforms, (list, tuple,), "transforms")
|
|
1071
|
+
for index, arg in enumerate(parsed_transforms):
|
|
1072
|
+
if not isinstance(arg, (TensorOp, TensorOperation)):
|
|
1073
|
+
raise TypeError("Type of Transforms[{0}] must be c_transform, but got {1}".format(index, type(arg)))
|
|
1074
|
+
|
|
1075
|
+
return method(self, *args, **kwargs)
|
|
1076
|
+
|
|
1077
|
+
return new_method
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
def check_uniform_augment(method):
|
|
1081
|
+
"""Wrapper method to check the parameters of UniformAugment Unified op."""
|
|
1082
|
+
|
|
1083
|
+
@wraps(method)
|
|
1084
|
+
def new_method(self, *args, **kwargs):
|
|
1085
|
+
[transforms, num_ops], _ = parse_user_args(method, *args, **kwargs)
|
|
1086
|
+
type_check(num_ops, (int,), "num_ops")
|
|
1087
|
+
check_positive(num_ops, "num_ops")
|
|
1088
|
+
|
|
1089
|
+
if num_ops > len(transforms):
|
|
1090
|
+
raise ValueError("num_ops is greater than transforms list size.")
|
|
1091
|
+
|
|
1092
|
+
type_check(transforms, (list, tuple,), "transforms list")
|
|
1093
|
+
if not transforms:
|
|
1094
|
+
raise ValueError("transforms list can not be empty.")
|
|
1095
|
+
for ind, op in enumerate(transforms):
|
|
1096
|
+
check_tensor_op(op, "transforms[{0}]".format(ind))
|
|
1097
|
+
check_transform_op_type(ind, op)
|
|
1098
|
+
|
|
1099
|
+
return method(self, *args, **kwargs)
|
|
1100
|
+
|
|
1101
|
+
return new_method
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
def check_bounding_box_augment_cpp(method):
|
|
1105
|
+
"""Wrapper method to check the parameters of BoundingBoxAugment C++ op."""
|
|
1106
|
+
|
|
1107
|
+
@wraps(method)
|
|
1108
|
+
def new_method(self, *args, **kwargs):
|
|
1109
|
+
[transform, ratio], _ = parse_user_args(method, *args, **kwargs)
|
|
1110
|
+
type_check(ratio, (float, int), "ratio")
|
|
1111
|
+
check_value(ratio, [0., 1.], "ratio")
|
|
1112
|
+
if transform and getattr(transform, 'parse', None):
|
|
1113
|
+
transform = transform.parse()
|
|
1114
|
+
type_check(transform, (TensorOp, TensorOperation), "transform")
|
|
1115
|
+
return method(self, *args, **kwargs)
|
|
1116
|
+
|
|
1117
|
+
return new_method
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
def check_adjust_brightness(method):
|
|
1121
|
+
"""Wrapper method to check the parameters of AdjustBrightness ops (Python and C++)."""
|
|
1122
|
+
|
|
1123
|
+
@wraps(method)
|
|
1124
|
+
def new_method(self, *args, **kwargs):
|
|
1125
|
+
[brightness_factor], _ = parse_user_args(method, *args, **kwargs)
|
|
1126
|
+
type_check(brightness_factor, (float, int), "brightness_factor")
|
|
1127
|
+
check_value(brightness_factor, (0, FLOAT_MAX_INTEGER), "brightness_factor")
|
|
1128
|
+
return method(self, *args, **kwargs)
|
|
1129
|
+
|
|
1130
|
+
return new_method
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
def check_adjust_contrast(method):
|
|
1134
|
+
"""Wrapper method to check the parameters of AdjustContrast ops (Python and C++)."""
|
|
1135
|
+
|
|
1136
|
+
@wraps(method)
|
|
1137
|
+
def new_method(self, *args, **kwargs):
|
|
1138
|
+
[contrast_factor], _ = parse_user_args(method, *args, **kwargs)
|
|
1139
|
+
type_check(contrast_factor, (float, int), "contrast_factor")
|
|
1140
|
+
check_value(contrast_factor, (0, FLOAT_MAX_INTEGER), "contrast_factor")
|
|
1141
|
+
return method(self, *args, **kwargs)
|
|
1142
|
+
|
|
1143
|
+
return new_method
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
def check_adjust_gamma(method):
|
|
1147
|
+
"""Wrapper method to check the parameters of AdjustGamma ops (Python and C++)."""
|
|
1148
|
+
|
|
1149
|
+
@wraps(method)
|
|
1150
|
+
def new_method(self, *args, **kwargs):
|
|
1151
|
+
[gamma, gain], _ = parse_user_args(method, *args, **kwargs)
|
|
1152
|
+
type_check(gamma, (float, int), "gamma")
|
|
1153
|
+
check_value(gamma, (0, FLOAT_MAX_INTEGER))
|
|
1154
|
+
if gain is not None:
|
|
1155
|
+
type_check(gain, (float, int), "gain")
|
|
1156
|
+
check_value(gain, (FLOAT_MIN_INTEGER, FLOAT_MAX_INTEGER))
|
|
1157
|
+
return method(self, *args, **kwargs)
|
|
1158
|
+
|
|
1159
|
+
return new_method
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
def check_adjust_hue(method):
|
|
1163
|
+
"""Wrapper method to check the parameters of AdjustHue ops (Python and C++)."""
|
|
1164
|
+
|
|
1165
|
+
@wraps(method)
|
|
1166
|
+
def new_method(self, *args, **kwargs):
|
|
1167
|
+
[hue_factor], _ = parse_user_args(method, *args, **kwargs)
|
|
1168
|
+
type_check(hue_factor, (float, int), "hue_factor")
|
|
1169
|
+
check_value(hue_factor, (-0.5, 0.5), "hue_factor")
|
|
1170
|
+
return method(self, *args, **kwargs)
|
|
1171
|
+
|
|
1172
|
+
return new_method
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
def check_adjust_saturation(method):
|
|
1176
|
+
"""Wrapper method to check the parameters of AdjustSaturation ops (Python and C++)."""
|
|
1177
|
+
|
|
1178
|
+
@wraps(method)
|
|
1179
|
+
def new_method(self, *args, **kwargs):
|
|
1180
|
+
[saturation_factor], _ = parse_user_args(method, *args, **kwargs)
|
|
1181
|
+
type_check(saturation_factor, (float, int), "saturation_factor")
|
|
1182
|
+
check_value(saturation_factor, (0, FLOAT_MAX_INTEGER))
|
|
1183
|
+
return method(self, *args, **kwargs)
|
|
1184
|
+
|
|
1185
|
+
return new_method
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
def check_adjust_sharpness(method):
|
|
1189
|
+
"""Wrapper method to check the parameters of AdjustSharpness ops (Python and C++)."""
|
|
1190
|
+
|
|
1191
|
+
@wraps(method)
|
|
1192
|
+
def new_method(self, *args, **kwargs):
|
|
1193
|
+
[sharpness_factor], _ = parse_user_args(method, *args, **kwargs)
|
|
1194
|
+
type_check(sharpness_factor, (float, int), "sharpness_factor")
|
|
1195
|
+
check_value(sharpness_factor, (0, FLOAT_MAX_INTEGER))
|
|
1196
|
+
return method(self, *args, **kwargs)
|
|
1197
|
+
|
|
1198
|
+
return new_method
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
def check_auto_contrast(method):
|
|
1202
|
+
"""Wrapper method to check the parameters of AutoContrast ops (Python and C++)."""
|
|
1203
|
+
|
|
1204
|
+
@wraps(method)
|
|
1205
|
+
def new_method(self, *args, **kwargs):
|
|
1206
|
+
[cutoff, ignore], _ = parse_user_args(method, *args, **kwargs)
|
|
1207
|
+
type_check(cutoff, (int, float), "cutoff")
|
|
1208
|
+
check_value_cutoff(cutoff, [0, 50], "cutoff")
|
|
1209
|
+
if ignore is not None:
|
|
1210
|
+
type_check(ignore, (list, tuple, int), "ignore")
|
|
1211
|
+
if isinstance(ignore, int):
|
|
1212
|
+
check_value(ignore, [0, 255], "ignore")
|
|
1213
|
+
if isinstance(ignore, (list, tuple)):
|
|
1214
|
+
for item in ignore:
|
|
1215
|
+
type_check(item, (int,), "item")
|
|
1216
|
+
check_value(item, [0, 255], "ignore")
|
|
1217
|
+
return method(self, *args, **kwargs)
|
|
1218
|
+
|
|
1219
|
+
return new_method
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
def check_uniform_augment_py(method):
|
|
1223
|
+
"""Wrapper method to check the parameters of Python UniformAugment op."""
|
|
1224
|
+
|
|
1225
|
+
@wraps(method)
|
|
1226
|
+
def new_method(self, *args, **kwargs):
|
|
1227
|
+
[transforms, num_ops], _ = parse_user_args(method, *args, **kwargs)
|
|
1228
|
+
type_check(transforms, (list,), "transforms")
|
|
1229
|
+
|
|
1230
|
+
if not transforms:
|
|
1231
|
+
raise ValueError("transforms list is empty.")
|
|
1232
|
+
|
|
1233
|
+
for transform in transforms:
|
|
1234
|
+
if isinstance(transform, TensorOp):
|
|
1235
|
+
raise ValueError("transform list only accepts Python operations.")
|
|
1236
|
+
|
|
1237
|
+
type_check(num_ops, (int,), "num_ops")
|
|
1238
|
+
check_positive(num_ops, "num_ops")
|
|
1239
|
+
if num_ops > len(transforms):
|
|
1240
|
+
raise ValueError("num_ops cannot be greater than the length of transforms list.")
|
|
1241
|
+
|
|
1242
|
+
return method(self, *args, **kwargs)
|
|
1243
|
+
|
|
1244
|
+
return new_method
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
def check_positive_degrees(method):
|
|
1248
|
+
"""A wrapper method to check degrees parameter in RandomSharpness and RandomColor ops (Python and C++)"""
|
|
1249
|
+
|
|
1250
|
+
@wraps(method)
|
|
1251
|
+
def new_method(self, *args, **kwargs):
|
|
1252
|
+
[degrees], _ = parse_user_args(method, *args, **kwargs)
|
|
1253
|
+
|
|
1254
|
+
if degrees is not None:
|
|
1255
|
+
if not isinstance(degrees, (list, tuple)):
|
|
1256
|
+
raise TypeError("degrees must be either a tuple or a list.")
|
|
1257
|
+
type_check_list(degrees, (int, float), "degrees")
|
|
1258
|
+
if len(degrees) != 2:
|
|
1259
|
+
raise ValueError("degrees must be a sequence with length 2.")
|
|
1260
|
+
for degree in degrees:
|
|
1261
|
+
check_value(degree, (0, FLOAT_MAX_INTEGER))
|
|
1262
|
+
if degrees[0] > degrees[1]:
|
|
1263
|
+
raise ValueError("degrees should be in (min,max) format. Got (max,min).")
|
|
1264
|
+
|
|
1265
|
+
return method(self, *args, **kwargs)
|
|
1266
|
+
|
|
1267
|
+
return new_method
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
def check_random_select_subpolicy_op(method):
|
|
1271
|
+
"""Wrapper method to check the parameters of RandomSelectSubpolicyOp."""
|
|
1272
|
+
|
|
1273
|
+
@wraps(method)
|
|
1274
|
+
def new_method(self, *args, **kwargs):
|
|
1275
|
+
[policy], _ = parse_user_args(method, *args, **kwargs)
|
|
1276
|
+
type_check(policy, (list,), "policy")
|
|
1277
|
+
if not policy:
|
|
1278
|
+
raise ValueError("policy can not be empty.")
|
|
1279
|
+
for sub_ind, sub in enumerate(policy):
|
|
1280
|
+
type_check(sub, (list,), "policy[{0}]".format([sub_ind]))
|
|
1281
|
+
if not sub:
|
|
1282
|
+
raise ValueError("policy[{0}] can not be empty.".format(sub_ind))
|
|
1283
|
+
for op_ind, tp in enumerate(sub):
|
|
1284
|
+
check_2tuple(tp, "policy[{0}][{1}]".format(sub_ind, op_ind))
|
|
1285
|
+
check_c_tensor_op(tp[0], "op of (op, prob) in policy[{0}][{1}]".format(sub_ind, op_ind))
|
|
1286
|
+
check_value(tp[1], (0, 1), "prob of (op, prob) policy[{0}][{1}]".format(sub_ind, op_ind))
|
|
1287
|
+
|
|
1288
|
+
return method(self, *args, **kwargs)
|
|
1289
|
+
|
|
1290
|
+
return new_method
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
def check_random_solarize(method):
|
|
1294
|
+
"""Wrapper method to check the parameters of RandomSolarizeOp."""
|
|
1295
|
+
|
|
1296
|
+
@wraps(method)
|
|
1297
|
+
def new_method(self, *args, **kwargs):
|
|
1298
|
+
[threshold], _ = parse_user_args(method, *args, **kwargs)
|
|
1299
|
+
|
|
1300
|
+
type_check(threshold, (tuple,), "threshold")
|
|
1301
|
+
type_check_list(threshold, (int,), "threshold")
|
|
1302
|
+
if len(threshold) != 2:
|
|
1303
|
+
raise ValueError("threshold must be a sequence of two numbers.")
|
|
1304
|
+
for element in threshold:
|
|
1305
|
+
check_value(element, (0, UINT8_MAX))
|
|
1306
|
+
if threshold[1] < threshold[0]:
|
|
1307
|
+
raise ValueError("threshold must be in min max format numbers.")
|
|
1308
|
+
|
|
1309
|
+
return method(self, *args, **kwargs)
|
|
1310
|
+
|
|
1311
|
+
return new_method
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
def check_gaussian_blur(method):
|
|
1315
|
+
"""Wrapper method to check the parameters of GaussianBlur."""
|
|
1316
|
+
|
|
1317
|
+
@wraps(method)
|
|
1318
|
+
def new_method(self, *args, **kwargs):
|
|
1319
|
+
[kernel_size, sigma], _ = parse_user_args(method, *args, **kwargs)
|
|
1320
|
+
|
|
1321
|
+
type_check(kernel_size, (int, list, tuple), "kernel_size")
|
|
1322
|
+
if isinstance(kernel_size, int):
|
|
1323
|
+
check_value(kernel_size, (1, FLOAT_MAX_INTEGER), "kernel_size")
|
|
1324
|
+
check_odd(kernel_size, "kernel_size")
|
|
1325
|
+
elif isinstance(kernel_size, (list, tuple)) and len(kernel_size) == 2:
|
|
1326
|
+
for index, value in enumerate(kernel_size):
|
|
1327
|
+
type_check(value, (int,), "kernel_size[{}]".format(index))
|
|
1328
|
+
check_value(value, (1, FLOAT_MAX_INTEGER), "kernel_size")
|
|
1329
|
+
check_odd(value, "kernel_size[{}]".format(index))
|
|
1330
|
+
else:
|
|
1331
|
+
raise TypeError(
|
|
1332
|
+
"Kernel size should be a single integer or a list/tuple (kernel_width, kernel_height) of length 2.")
|
|
1333
|
+
|
|
1334
|
+
if sigma is not None:
|
|
1335
|
+
type_check(sigma, (numbers.Number, list, tuple), "sigma")
|
|
1336
|
+
if isinstance(sigma, numbers.Number):
|
|
1337
|
+
check_value(sigma, (0, FLOAT_MAX_INTEGER), "sigma")
|
|
1338
|
+
elif isinstance(sigma, (list, tuple)) and len(sigma) == 2:
|
|
1339
|
+
for index, value in enumerate(sigma):
|
|
1340
|
+
type_check(value, (numbers.Number,), "size[{}]".format(index))
|
|
1341
|
+
check_value(value, (0, FLOAT_MAX_INTEGER), "sigma")
|
|
1342
|
+
else:
|
|
1343
|
+
raise TypeError("Sigma should be a single number or a list/tuple of length 2 for width and height.")
|
|
1344
|
+
|
|
1345
|
+
return method(self, *args, **kwargs)
|
|
1346
|
+
|
|
1347
|
+
return new_method
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
def check_convert_color(method):
|
|
1351
|
+
"""Wrapper method to check the parameters of convertcolor."""
|
|
1352
|
+
|
|
1353
|
+
@wraps(method)
|
|
1354
|
+
def new_method(self, *args, **kwargs):
|
|
1355
|
+
[convert_mode], _ = parse_user_args(method, *args, **kwargs)
|
|
1356
|
+
type_check(convert_mode, (ConvertMode,), "convert_mode")
|
|
1357
|
+
return method(self, *args, **kwargs)
|
|
1358
|
+
|
|
1359
|
+
return new_method
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
def check_auto_augment(method):
|
|
1363
|
+
"""Wrapper method to check the parameters of AutoAugment."""
|
|
1364
|
+
|
|
1365
|
+
@wraps(method)
|
|
1366
|
+
def new_method(self, *args, **kwargs):
|
|
1367
|
+
[policy, interpolation, fill_value], _ = parse_user_args(method, *args, **kwargs)
|
|
1368
|
+
|
|
1369
|
+
type_check(policy, (AutoAugmentPolicy,), "policy")
|
|
1370
|
+
type_check(interpolation, (Inter,), "interpolation")
|
|
1371
|
+
check_fill_value(fill_value)
|
|
1372
|
+
return method(self, *args, **kwargs)
|
|
1373
|
+
|
|
1374
|
+
return new_method
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
def check_to_tensor(method):
|
|
1378
|
+
"""Wrapper method to check the parameters of ToTensor."""
|
|
1379
|
+
|
|
1380
|
+
@wraps(method)
|
|
1381
|
+
def new_method(self, *args, **kwargs):
|
|
1382
|
+
[output_type], _ = parse_user_args(method, *args, **kwargs)
|
|
1383
|
+
|
|
1384
|
+
# Check if output_type is mindspore.dtype
|
|
1385
|
+
if isinstance(output_type, (typing.Type,)):
|
|
1386
|
+
return method(self, *args, **kwargs)
|
|
1387
|
+
|
|
1388
|
+
# Special case: Check if output_type is None (which is invalid)
|
|
1389
|
+
if output_type is None:
|
|
1390
|
+
# Use type_check to raise error with descriptive error message
|
|
1391
|
+
type_check(output_type, (typing.Type, np.dtype,), "output_type")
|
|
1392
|
+
|
|
1393
|
+
try:
|
|
1394
|
+
# Check if output_type can be converted to numpy type
|
|
1395
|
+
_ = np.dtype(output_type)
|
|
1396
|
+
except (TypeError, ValueError):
|
|
1397
|
+
# Use type_check to raise error with descriptive error message
|
|
1398
|
+
type_check(output_type, (typing.Type, np.dtype,), "output_type")
|
|
1399
|
+
|
|
1400
|
+
return method(self, *args, **kwargs)
|
|
1401
|
+
|
|
1402
|
+
return new_method
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
def deprecated_c_vision(substitute_name=None, substitute_module=None):
|
|
1406
|
+
"""Decorator for version 1.8 deprecation warning for legacy mindspore.dataset.vision.c_transforms operation.
|
|
1407
|
+
|
|
1408
|
+
Args:
|
|
1409
|
+
substitute_name (str, optional): The substitute name for deprecated operation.
|
|
1410
|
+
substitute_module (str, optional): The substitute module for deprecated operation.
|
|
1411
|
+
"""
|
|
1412
|
+
return deprecator_factory("1.8", "mindspore.dataset.vision.c_transforms", "mindspore.dataset.vision",
|
|
1413
|
+
substitute_name, substitute_module)
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
def deprecated_py_vision(substitute_name=None, substitute_module=None):
|
|
1417
|
+
"""Decorator for version 1.8 deprecation warning for legacy mindspore.dataset.vision.py_transforms operation.
|
|
1418
|
+
|
|
1419
|
+
Args:
|
|
1420
|
+
substitute_name (str, optional): The substitute name for deprecated operation.
|
|
1421
|
+
substitute_module (str, optional): The substitute module for deprecated operation.
|
|
1422
|
+
"""
|
|
1423
|
+
return deprecator_factory("1.8", "mindspore.dataset.vision.py_transforms", "mindspore.dataset.vision",
|
|
1424
|
+
substitute_name, substitute_module)
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
def check_solarize(method):
|
|
1428
|
+
"""Wrapper method to check the parameters of SolarizeOp."""
|
|
1429
|
+
|
|
1430
|
+
@wraps(method)
|
|
1431
|
+
def new_method(self, *args, **kwargs):
|
|
1432
|
+
|
|
1433
|
+
[threshold], _ = parse_user_args(method, *args, **kwargs)
|
|
1434
|
+
type_check(threshold, (float, int, list, tuple), "threshold")
|
|
1435
|
+
if isinstance(threshold, (float, int)):
|
|
1436
|
+
threshold = (threshold, threshold)
|
|
1437
|
+
type_check_list(threshold, (float, int), "threshold")
|
|
1438
|
+
if len(threshold) != 2:
|
|
1439
|
+
raise TypeError("threshold must be a single number or sequence of two numbers.")
|
|
1440
|
+
for i, value in enumerate(threshold):
|
|
1441
|
+
check_value(value, (UINT8_MIN, UINT8_MAX), "threshold[{}]".format(i))
|
|
1442
|
+
if threshold[1] < threshold[0]:
|
|
1443
|
+
raise ValueError("threshold must be in order of (min, max).")
|
|
1444
|
+
|
|
1445
|
+
return method(self, *args, **kwargs)
|
|
1446
|
+
|
|
1447
|
+
return new_method
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
def check_trivial_augment_wide(method):
|
|
1451
|
+
"""Wrapper method to check the parameters of TrivialAugmentWide."""
|
|
1452
|
+
|
|
1453
|
+
@wraps(method)
|
|
1454
|
+
def new_method(self, *args, **kwargs):
|
|
1455
|
+
[num_magnitude_bins, interpolation, fill_value], _ = parse_user_args(method, *args, **kwargs)
|
|
1456
|
+
type_check(num_magnitude_bins, (int,), "num_magnitude_bins")
|
|
1457
|
+
check_value(num_magnitude_bins, (2, FLOAT_MAX_INTEGER), "num_magnitude_bins")
|
|
1458
|
+
type_check(interpolation, (Inter,), "interpolation")
|
|
1459
|
+
check_fill_value(fill_value)
|
|
1460
|
+
return method(self, *args, **kwargs)
|
|
1461
|
+
|
|
1462
|
+
return new_method
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
def check_rand_augment(method):
|
|
1466
|
+
"""Wrapper method to check the parameters of RandAugment."""
|
|
1467
|
+
|
|
1468
|
+
@wraps(method)
|
|
1469
|
+
def new_method(self, *args, **kwargs):
|
|
1470
|
+
[num_ops, magnitude, num_magnitude_bins, interpolation, fill_value], _ = parse_user_args(method, *args,
|
|
1471
|
+
**kwargs)
|
|
1472
|
+
|
|
1473
|
+
type_check(num_ops, (int,), "num_ops")
|
|
1474
|
+
check_value(num_ops, (0, FLOAT_MAX_INTEGER), "num_ops")
|
|
1475
|
+
type_check(num_magnitude_bins, (int,), "num_magnitude_bins")
|
|
1476
|
+
check_value(num_magnitude_bins, (2, FLOAT_MAX_INTEGER), "num_magnitude_bins")
|
|
1477
|
+
type_check(magnitude, (int,), "magnitude")
|
|
1478
|
+
check_value(magnitude, (0, num_magnitude_bins), "magnitude", right_open_interval=True)
|
|
1479
|
+
type_check(interpolation, (Inter,), "interpolation")
|
|
1480
|
+
check_fill_value(fill_value)
|
|
1481
|
+
return method(self, *args, **kwargs)
|
|
1482
|
+
|
|
1483
|
+
return new_method
|