mindspore 2.2.14__cp39-cp39-win_amd64.whl → 2.4.0__cp39-cp39-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 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +8 -5
- mindspore/_c_dataengine.cp39-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp39-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp39-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +124 -25
- mindspore/_extends/builtin_operations.py +2 -1
- mindspore/_extends/graph_kernel/model/graph_parallel.py +16 -6
- mindspore/_extends/parallel_compile/akg_compiler/akg_process.py +3 -16
- mindspore/_extends/parallel_compile/akg_compiler/build_tbe_kernel.py +16 -4
- mindspore/_extends/parallel_compile/akg_compiler/compiler.py +1 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/tbe_topi.py +2 -1
- mindspore/_extends/parallel_compile/akg_compiler/util.py +5 -2
- mindspore/_extends/parse/__init__.py +18 -14
- mindspore/_extends/parse/compile_config.py +299 -0
- mindspore/_extends/parse/namespace.py +2 -2
- mindspore/_extends/parse/parser.py +182 -68
- mindspore/_extends/parse/resources.py +45 -14
- mindspore/_extends/parse/standard_method.py +192 -252
- mindspore/{ops/_op_impl/tbe/atomic_addr_clean.py → _extends/pijit/__init__.py} +6 -16
- mindspore/_extends/pijit/pijit_func_white_list.py +669 -0
- mindspore/_extends/remote/kernel_build_server.py +2 -0
- mindspore/_profiler.py +30 -0
- mindspore/amp.py +67 -26
- 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/adasum.py +1 -1
- mindspore/boost/base.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +2 -2
- mindspore/boost/grad_freeze.py +2 -2
- mindspore/boost/group_loss_scale_manager.py +1 -1
- mindspore/boost/less_batch_normalization.py +9 -6
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +20 -7
- mindspore/common/_jit_fallback_utils.py +2 -3
- mindspore/common/_pijit_context.py +190 -0
- mindspore/common/_register_for_adapter.py +7 -0
- mindspore/common/_register_for_recompute.py +48 -0
- mindspore/common/_register_for_tensor.py +10 -10
- mindspore/common/_stub_tensor.py +7 -1
- mindspore/common/_tensor_overload.py +139 -0
- mindspore/common/_utils.py +5 -17
- mindspore/common/api.py +449 -129
- mindspore/common/auto_dynamic_shape.py +27 -14
- mindspore/common/dtype.py +17 -10
- mindspore/common/dump.py +8 -11
- mindspore/common/file_system.py +48 -0
- mindspore/common/generator.py +254 -0
- mindspore/common/hook_handle.py +65 -30
- mindspore/common/initializer.py +1 -1
- mindspore/common/jit_config.py +34 -14
- mindspore/common/lazy_inline.py +72 -19
- mindspore/common/mindir_util.py +12 -2
- mindspore/common/mutable.py +79 -14
- mindspore/common/no_inline.py +54 -0
- mindspore/common/np_dtype.py +25 -0
- mindspore/common/parameter.py +73 -21
- mindspore/common/recompute.py +292 -0
- mindspore/common/seed.py +9 -9
- mindspore/common/sparse_tensor.py +276 -24
- mindspore/common/symbol.py +122 -0
- mindspore/common/tensor.py +668 -514
- mindspore/communication/__init__.py +6 -11
- mindspore/communication/_comm_helper.py +43 -3
- mindspore/communication/comm_func.py +1395 -0
- mindspore/communication/management.py +117 -104
- mindspore/config/op_info.config +22 -54
- mindspore/context.py +455 -71
- mindspore/dataset/__init__.py +5 -5
- mindspore/dataset/audio/__init__.py +6 -6
- mindspore/dataset/audio/transforms.py +711 -158
- mindspore/dataset/callback/ds_callback.py +2 -2
- mindspore/dataset/core/config.py +7 -0
- mindspore/dataset/core/validator_helpers.py +7 -0
- mindspore/dataset/engine/cache_client.py +2 -2
- mindspore/dataset/engine/datasets.py +201 -116
- mindspore/dataset/engine/datasets_audio.py +14 -14
- mindspore/dataset/engine/datasets_standard_format.py +83 -3
- mindspore/dataset/engine/datasets_text.py +39 -39
- mindspore/dataset/engine/datasets_user_defined.py +230 -141
- mindspore/dataset/engine/datasets_vision.py +78 -74
- mindspore/dataset/engine/iterators.py +29 -0
- mindspore/dataset/engine/obs/util.py +7 -0
- mindspore/dataset/engine/offload.py +5 -7
- mindspore/dataset/engine/queue.py +138 -66
- mindspore/dataset/engine/serializer_deserializer.py +2 -2
- mindspore/dataset/engine/validators.py +41 -15
- mindspore/dataset/text/__init__.py +2 -5
- mindspore/dataset/text/transforms.py +408 -121
- mindspore/dataset/text/utils.py +9 -9
- mindspore/dataset/transforms/__init__.py +0 -3
- mindspore/dataset/transforms/transforms.py +261 -76
- mindspore/dataset/utils/browse_dataset.py +9 -9
- mindspore/dataset/utils/line_reader.py +2 -0
- mindspore/dataset/vision/__init__.py +7 -10
- mindspore/dataset/vision/c_transforms.py +10 -10
- mindspore/dataset/vision/py_transforms_util.py +1 -1
- mindspore/dataset/vision/transforms.py +2844 -549
- mindspore/dataset/vision/utils.py +161 -10
- mindspore/dataset/vision/validators.py +16 -3
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/{rewrite/ast_creator_register.py → experimental/es/__init__.py} +5 -20
- 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/optim/__init__.py +12 -2
- mindspore/experimental/optim/adadelta.py +161 -0
- mindspore/experimental/optim/adagrad.py +168 -0
- mindspore/experimental/optim/adam.py +35 -34
- mindspore/experimental/optim/adamax.py +170 -0
- mindspore/experimental/optim/adamw.py +124 -15
- mindspore/experimental/optim/asgd.py +153 -0
- mindspore/experimental/optim/lr_scheduler.py +66 -121
- mindspore/experimental/optim/nadam.py +157 -0
- mindspore/experimental/optim/optimizer.py +18 -8
- 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 +28 -19
- 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/api/data_type.h +2 -2
- mindspore/include/api/dual_abi_helper.h +16 -3
- mindspore/include/api/model.h +4 -3
- mindspore/include/api/model_group.h +13 -1
- mindspore/include/api/status.h +14 -0
- mindspore/include/api/types.h +10 -10
- mindspore/include/c_api/model_c.h +173 -0
- mindspore/include/c_api/types_c.h +19 -0
- mindspore/include/dataset/config.h +2 -2
- mindspore/include/dataset/constants.h +2 -2
- mindspore/include/dataset/execute.h +3 -5
- mindspore/include/dataset/vision.h +58 -2
- mindspore/jpeg62.dll +0 -0
- mindspore/log.py +3 -3
- mindspore/mindrecord/__init__.py +5 -1
- mindspore/mindrecord/config.py +809 -0
- mindspore/mindrecord/filereader.py +25 -0
- mindspore/mindrecord/filewriter.py +138 -103
- mindspore/mindrecord/mindpage.py +40 -6
- mindspore/mindrecord/shardutils.py +3 -2
- mindspore/mindrecord/shardwriter.py +7 -0
- mindspore/mindrecord/tools/cifar100_to_mr.py +8 -13
- mindspore/mindrecord/tools/cifar10_to_mr.py +9 -15
- mindspore/mindrecord/tools/csv_to_mr.py +4 -9
- mindspore/mindrecord/tools/imagenet_to_mr.py +3 -8
- mindspore/mindrecord/tools/mnist_to_mr.py +7 -12
- mindspore/mindrecord/tools/tfrecord_to_mr.py +1 -6
- 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/{rewrite/ast_transformers → mint/linalg}/__init__.py +9 -4
- 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_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/cell.py +461 -323
- mindspore/nn/dynamic_lr.py +2 -2
- mindspore/nn/layer/activation.py +292 -135
- mindspore/nn/layer/basic.py +288 -83
- mindspore/nn/layer/channel_shuffle.py +3 -16
- mindspore/nn/layer/container.py +3 -3
- mindspore/nn/layer/conv.py +75 -66
- mindspore/nn/layer/embedding.py +221 -45
- mindspore/nn/layer/image.py +4 -7
- mindspore/nn/layer/math.py +1 -1
- mindspore/nn/layer/normalization.py +150 -68
- mindspore/nn/layer/padding.py +64 -87
- mindspore/nn/layer/pooling.py +175 -12
- mindspore/nn/layer/rnn_cells.py +6 -16
- mindspore/nn/layer/rnns.py +6 -5
- mindspore/nn/layer/thor_layer.py +1 -2
- mindspore/nn/layer/timedistributed.py +1 -1
- mindspore/nn/layer/transformer.py +55 -53
- mindspore/nn/learning_rate_schedule.py +6 -5
- mindspore/nn/loss/__init__.py +2 -2
- mindspore/nn/loss/loss.py +145 -88
- mindspore/nn/optim/__init__.py +2 -1
- mindspore/nn/optim/ada_grad.py +4 -2
- mindspore/nn/optim/adadelta.py +4 -2
- mindspore/nn/optim/adafactor.py +1 -1
- mindspore/nn/optim/adam.py +102 -181
- mindspore/nn/optim/adamax.py +4 -2
- mindspore/nn/optim/adasum.py +3 -3
- mindspore/nn/optim/asgd.py +4 -2
- mindspore/nn/optim/ftrl.py +31 -61
- mindspore/nn/optim/lamb.py +5 -3
- mindspore/nn/optim/lars.py +2 -2
- mindspore/nn/optim/lazyadam.py +6 -4
- mindspore/nn/optim/momentum.py +13 -25
- mindspore/nn/optim/optimizer.py +6 -3
- mindspore/nn/optim/proximal_ada_grad.py +4 -2
- mindspore/nn/optim/rmsprop.py +9 -3
- mindspore/nn/optim/rprop.py +4 -2
- mindspore/nn/optim/sgd.py +5 -3
- mindspore/nn/optim/tft_wrapper.py +127 -0
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/_utils/custom_ops.py +2 -2
- mindspore/nn/probability/distribution/beta.py +2 -2
- mindspore/nn/probability/distribution/categorical.py +4 -6
- mindspore/nn/probability/distribution/cauchy.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -2
- mindspore/nn/probability/distribution/geometric.py +1 -1
- mindspore/nn/probability/distribution/gumbel.py +2 -2
- mindspore/nn/probability/distribution/logistic.py +1 -1
- mindspore/nn/probability/distribution/poisson.py +2 -2
- mindspore/nn/probability/distribution/uniform.py +2 -2
- mindspore/nn/reinforcement/_tensors_queue.py +13 -1
- mindspore/nn/wrap/__init__.py +2 -1
- mindspore/nn/wrap/cell_wrapper.py +46 -12
- mindspore/nn/wrap/grad_reducer.py +148 -8
- mindspore/nn/wrap/loss_scale.py +44 -7
- mindspore/numpy/__init__.py +2 -0
- mindspore/numpy/array_creations.py +67 -68
- mindspore/numpy/array_ops.py +70 -66
- mindspore/numpy/dtypes.py +3 -3
- mindspore/numpy/fft.py +966 -0
- mindspore/numpy/logic_ops.py +11 -10
- mindspore/numpy/math_ops.py +147 -152
- mindspore/numpy/utils.py +3 -0
- mindspore/numpy/utils_const.py +4 -4
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/__init__.py +9 -6
- mindspore/ops/_grad_experimental/grad_array_ops.py +4 -129
- mindspore/ops/_grad_experimental/grad_comm_ops.py +135 -36
- mindspore/ops/_grad_experimental/grad_math_ops.py +61 -298
- mindspore/ops/_grad_experimental/grad_nn_ops.py +0 -53
- mindspore/ops/_grad_experimental/grad_quant_ops.py +3 -3
- mindspore/ops/_grad_experimental/grad_sparse.py +1 -1
- mindspore/ops/_grad_experimental/grad_sparse_ops.py +3 -3
- mindspore/ops/_op_impl/__init__.py +0 -1
- mindspore/ops/_op_impl/aicpu/gamma.py +2 -0
- mindspore/ops/_op_impl/aicpu/generate_eod_mask.py +1 -1
- mindspore/ops/_op_impl/aicpu/log_uniform_candidate_sampler.py +1 -3
- mindspore/ops/_op_impl/aicpu/poisson.py +2 -0
- mindspore/ops/_op_impl/cpu/__init__.py +1 -3
- mindspore/ops/_op_impl/cpu/adam.py +2 -2
- mindspore/ops/_op_impl/cpu/adam_weight_decay.py +3 -2
- mindspore/ops/_op_impl/cpu/maximum_grad.py +16 -14
- mindspore/ops/_op_impl/cpu/minimum_grad.py +8 -0
- mindspore/ops/_vmap/vmap_array_ops.py +162 -101
- mindspore/ops/_vmap/vmap_base.py +8 -1
- mindspore/ops/_vmap/vmap_grad_math_ops.py +95 -9
- mindspore/ops/_vmap/vmap_grad_nn_ops.py +143 -58
- mindspore/ops/_vmap/vmap_image_ops.py +70 -13
- mindspore/ops/_vmap/vmap_math_ops.py +147 -59
- mindspore/ops/_vmap/vmap_nn_ops.py +292 -117
- mindspore/ops/_vmap/vmap_other_ops.py +1 -1
- 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 +5 -2
- mindspore/ops/composite/base.py +201 -66
- mindspore/ops/composite/math_ops.py +10 -49
- mindspore/ops/composite/multitype_ops/_compile_utils.py +192 -618
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +25 -134
- mindspore/ops/composite/multitype_ops/add_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/bitwise_and_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/bitwise_or_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/bitwise_xor_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/div_impl.py +8 -0
- mindspore/ops/composite/multitype_ops/equal_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +8 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/greater_equal_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/greater_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/in_impl.py +8 -2
- mindspore/ops/composite/multitype_ops/left_shift_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/less_equal_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/less_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/logic_not_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/logical_and_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/logical_or_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/mul_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/negative_impl.py +9 -3
- mindspore/ops/composite/multitype_ops/not_equal_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/not_in_impl.py +8 -3
- mindspore/ops/composite/multitype_ops/ones_like_impl.py +2 -2
- mindspore/ops/composite/multitype_ops/pow_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/right_shift_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +32 -21
- mindspore/ops/composite/multitype_ops/sub_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +6 -3
- mindspore/ops/deprecated.py +14 -3
- mindspore/ops/function/__init__.py +53 -11
- mindspore/ops/function/array_func.py +1269 -1821
- mindspore/ops/function/clip_func.py +19 -31
- mindspore/ops/function/debug_func.py +114 -5
- mindspore/ops/function/fft_func.py +44 -0
- mindspore/ops/function/grad/grad_func.py +30 -22
- mindspore/ops/function/image_func.py +27 -21
- mindspore/ops/function/linalg_func.py +35 -68
- mindspore/ops/function/math_func.py +1170 -2697
- mindspore/ops/function/nn_func.py +2116 -1128
- mindspore/ops/function/other_func.py +8 -8
- mindspore/ops/function/parameter_func.py +5 -93
- mindspore/ops/function/random_func.py +435 -113
- mindspore/ops/function/reshard_func.py +104 -0
- mindspore/ops/function/sparse_func.py +4 -4
- mindspore/ops/function/sparse_unary_func.py +9 -16
- mindspore/ops/function/spectral_func.py +1 -1
- mindspore/ops/function/vmap_func.py +16 -15
- mindspore/ops/functional.py +355 -346
- mindspore/ops/op_info_register.py +18 -45
- mindspore/ops/operations/__init__.py +38 -24
- mindspore/ops/operations/_grad_ops.py +21 -927
- mindspore/ops/operations/_infer_ops.py +19 -0
- mindspore/ops/operations/_inner_ops.py +173 -607
- mindspore/ops/operations/_rl_inner_ops.py +2 -2
- mindspore/ops/operations/_scalar_ops.py +5 -480
- mindspore/ops/operations/_sequence_ops.py +6 -36
- mindspore/ops/operations/_tensor_array.py +8 -8
- mindspore/ops/operations/array_ops.py +106 -2837
- mindspore/ops/operations/comm_ops.py +799 -127
- mindspore/ops/operations/custom_ops.py +124 -119
- mindspore/ops/operations/debug_ops.py +142 -41
- mindspore/ops/operations/image_ops.py +1 -217
- mindspore/ops/operations/inner_ops.py +5 -40
- mindspore/ops/operations/linalg_ops.py +1 -49
- 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 +666 -4972
- mindspore/ops/operations/nn_ops.py +205 -2213
- mindspore/ops/operations/other_ops.py +60 -49
- mindspore/ops/operations/random_ops.py +50 -54
- mindspore/ops/operations/reshard_ops.py +53 -0
- mindspore/ops/operations/sparse_ops.py +4 -4
- mindspore/ops/primitive.py +216 -103
- 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 +8 -4
- mindspore/parallel/_auto_parallel_context.py +100 -10
- mindspore/parallel/_cell_wrapper.py +99 -9
- mindspore/parallel/_cost_model_context.py +1 -1
- mindspore/parallel/_dp_allreduce_fusion.py +159 -159
- mindspore/parallel/_parallel_serialization.py +67 -23
- mindspore/parallel/_ps_context.py +1 -1
- mindspore/parallel/_recovery_context.py +1 -1
- mindspore/parallel/_tensor.py +99 -22
- mindspore/parallel/_transformer/__init__.py +1 -1
- mindspore/parallel/_transformer/layers.py +1 -1
- mindspore/parallel/_transformer/loss.py +1 -1
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/op_parallel_config.py +1 -1
- mindspore/parallel/_transformer/transformer.py +2 -2
- mindspore/parallel/_utils.py +173 -6
- mindspore/parallel/algo_parameter_config.py +8 -10
- mindspore/parallel/checkpoint_transform.py +204 -38
- 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 +1 -1
- mindspore/parallel/mpi/_mpi_config.py +1 -1
- mindspore/parallel/parameter_broadcast.py +151 -0
- mindspore/parallel/shard.py +279 -37
- mindspore/parallel/transform_safetensors.py +993 -0
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +4 -2
- mindspore/profiler/common/constant.py +29 -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/util.py +153 -0
- mindspore/profiler/dynamic_profiler.py +694 -0
- mindspore/profiler/envprofiling.py +18 -20
- mindspore/{_extends/parallel_compile/tbe_compiler → profiler/parser/ascend_analysis}/__init__.py +1 -1
- 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 +14 -9
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -1
- mindspore/profiler/parser/ascend_flops_generator.py +20 -4
- mindspore/profiler/parser/ascend_hccl_generator.py +29 -278
- 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 +148 -146
- mindspore/profiler/parser/ascend_msprof_generator.py +73 -283
- mindspore/profiler/parser/ascend_op_generator.py +92 -42
- mindspore/profiler/parser/ascend_timeline_generator.py +298 -133
- mindspore/profiler/parser/base_timeline_generator.py +25 -25
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +25 -12
- mindspore/profiler/parser/framework_parser.py +4 -393
- 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/integrator.py +3 -1
- mindspore/profiler/parser/memory_usage_parser.py +0 -154
- mindspore/profiler/parser/minddata_parser.py +72 -3
- mindspore/profiler/parser/profiler_info.py +94 -7
- mindspore/profiler/profiler.py +153 -0
- mindspore/profiler/profiling.py +631 -508
- mindspore/rewrite/__init__.py +2 -14
- mindspore/rewrite/api/node.py +122 -36
- mindspore/rewrite/api/pattern_engine.py +2 -3
- mindspore/rewrite/api/scoped_value.py +16 -15
- mindspore/rewrite/api/symbol_tree.py +45 -29
- mindspore/rewrite/ast_helpers/__init__.py +3 -6
- mindspore/rewrite/ast_helpers/ast_converter.py +143 -0
- mindspore/rewrite/ast_helpers/ast_finder.py +48 -0
- mindspore/rewrite/ast_helpers/ast_flattener.py +268 -0
- mindspore/rewrite/ast_helpers/ast_modifier.py +160 -92
- mindspore/rewrite/common/__init__.py +1 -2
- mindspore/rewrite/common/config.py +24 -0
- mindspore/rewrite/common/{rewrite_elog.py → error_log.py} +39 -39
- mindspore/rewrite/{namer.py → common/namer.py} +63 -18
- mindspore/rewrite/common/namespace.py +118 -0
- mindspore/rewrite/node/__init__.py +5 -5
- mindspore/rewrite/node/call_function.py +23 -7
- mindspore/rewrite/node/cell_container.py +7 -3
- mindspore/rewrite/node/control_flow.py +53 -28
- mindspore/rewrite/node/node.py +212 -196
- mindspore/rewrite/node/node_manager.py +51 -22
- mindspore/rewrite/node/node_topological_manager.py +3 -23
- mindspore/rewrite/parsers/__init__.py +12 -0
- mindspore/rewrite/parsers/arguments_parser.py +8 -9
- mindspore/rewrite/parsers/assign_parser.py +637 -413
- mindspore/rewrite/parsers/attribute_parser.py +3 -4
- mindspore/rewrite/parsers/class_def_parser.py +115 -148
- mindspore/rewrite/parsers/constant_parser.py +5 -5
- mindspore/rewrite/parsers/container_parser.py +4 -6
- mindspore/rewrite/parsers/expr_parser.py +55 -0
- mindspore/rewrite/parsers/for_parser.py +31 -98
- mindspore/rewrite/parsers/function_def_parser.py +13 -5
- mindspore/rewrite/parsers/if_parser.py +28 -10
- mindspore/rewrite/parsers/module_parser.py +8 -182
- mindspore/rewrite/parsers/parser.py +1 -5
- mindspore/rewrite/parsers/parser_register.py +1 -1
- mindspore/rewrite/parsers/return_parser.py +5 -10
- mindspore/rewrite/parsers/while_parser.py +59 -0
- mindspore/rewrite/sparsify/utils.py +1 -1
- mindspore/rewrite/symbol_tree/__init__.py +20 -0
- mindspore/rewrite/{symbol_tree.py → symbol_tree/symbol_tree.py} +705 -186
- mindspore/rewrite/{symbol_tree_builder.py → symbol_tree/symbol_tree_builder.py} +8 -8
- mindspore/rewrite/{symbol_tree_dumper.py → symbol_tree/symbol_tree_dumper.py} +4 -4
- mindspore/run_check/_check_version.py +40 -115
- mindspore/run_check/run_check.py +1 -1
- mindspore/safeguard/rewrite_obfuscation.py +597 -263
- 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 +7 -5
- mindspore/train/_utils.py +204 -4
- mindspore/train/amp.py +335 -295
- mindspore/train/anf_ir_pb2.py +14 -2
- mindspore/train/callback/__init__.py +5 -2
- mindspore/train/callback/_backup_and_restore.py +5 -5
- mindspore/train/callback/_callback.py +4 -4
- mindspore/train/callback/_checkpoint.py +220 -43
- mindspore/train/callback/_cluster_monitor.py +201 -0
- mindspore/train/callback/_early_stop.py +2 -2
- mindspore/train/callback/_flops_collector.py +239 -0
- mindspore/train/callback/_landscape.py +15 -9
- mindspore/train/callback/_loss_monitor.py +5 -5
- mindspore/train/callback/_on_request_exit.py +136 -33
- mindspore/train/callback/_reduce_lr_on_plateau.py +2 -2
- mindspore/train/callback/_summary_collector.py +12 -12
- mindspore/train/callback/_tft_register.py +352 -0
- mindspore/train/callback/_time_monitor.py +3 -3
- mindspore/train/data_sink.py +6 -5
- mindspore/train/dataset_helper.py +66 -23
- mindspore/train/loss_scale_manager.py +2 -2
- mindspore/train/metrics/accuracy.py +7 -7
- mindspore/train/metrics/confusion_matrix.py +8 -6
- mindspore/train/metrics/cosine_similarity.py +6 -4
- mindspore/train/metrics/error.py +2 -2
- mindspore/train/metrics/metric.py +3 -3
- mindspore/train/metrics/perplexity.py +2 -1
- mindspore/train/metrics/roc.py +4 -4
- mindspore/train/metrics/topk.py +2 -2
- mindspore/train/mind_ir_pb2.py +116 -37
- mindspore/train/model.py +382 -76
- mindspore/train/serialization.py +787 -288
- mindspore/train/summary/_summary_adapter.py +1 -1
- mindspore/train/summary/summary_record.py +51 -28
- mindspore/train/train_thor/convert_utils.py +3 -3
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +21 -0
- mindspore/utils/utils.py +60 -0
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.2.14.dist-info → mindspore-2.4.0.dist-info}/METADATA +8 -4
- mindspore-2.4.0.dist-info/RECORD +1406 -0
- {mindspore-2.2.14.dist-info → mindspore-2.4.0.dist-info}/entry_points.txt +1 -0
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_adapter.py +0 -662
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_helper.py +0 -377
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_job.py +0 -201
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_job_manager.py +0 -515
- mindspore/gen_ops.py +0 -273
- mindspore/include/c_api/ms/abstract.h +0 -67
- mindspore/include/c_api/ms/attribute.h +0 -197
- mindspore/include/c_api/ms/base/handle_types.h +0 -43
- mindspore/include/c_api/ms/base/macros.h +0 -32
- mindspore/include/c_api/ms/base/status.h +0 -33
- mindspore/include/c_api/ms/base/types.h +0 -282
- mindspore/include/c_api/ms/context.h +0 -102
- mindspore/include/c_api/ms/graph.h +0 -160
- mindspore/include/c_api/ms/node.h +0 -606
- mindspore/include/c_api/ms/tensor.h +0 -161
- mindspore/include/c_api/ms/value.h +0 -84
- mindspore/mindspore_shared_lib.dll +0 -0
- mindspore/nn/layer/flash_attention.py +0 -189
- mindspore/ops/_op_impl/aicpu/strided_slice_v2.py +0 -93
- mindspore/ops/_op_impl/aicpu/strided_slice_v2_grad.py +0 -66
- mindspore/ops/_op_impl/cpu/concat.py +0 -39
- mindspore/ops/_op_impl/cpu/tensor_shape.py +0 -42
- mindspore/ops/_op_impl/tbe/__init__.py +0 -47
- mindspore/ops/_op_impl/tbe/abs.py +0 -38
- mindspore/ops/_op_impl/tbe/abs_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/abs_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/abs_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/accumulate_n_v2.py +0 -41
- mindspore/ops/_op_impl/tbe/accumulate_n_v2_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/acos.py +0 -37
- mindspore/ops/_op_impl/tbe/acos_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/acos_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/acos_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/acosh.py +0 -37
- mindspore/ops/_op_impl/tbe/acosh_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/acosh_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/acosh_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/act_ulq_clamp_max_grad.py +0 -38
- mindspore/ops/_op_impl/tbe/act_ulq_clamp_min_grad.py +0 -38
- mindspore/ops/_op_impl/tbe/acts_ulq.py +0 -45
- mindspore/ops/_op_impl/tbe/acts_ulq_input_grad.py +0 -38
- mindspore/ops/_op_impl/tbe/adam_apply_one.py +0 -50
- mindspore/ops/_op_impl/tbe/adam_apply_one_assign.py +0 -53
- mindspore/ops/_op_impl/tbe/adam_apply_one_ds.py +0 -51
- mindspore/ops/_op_impl/tbe/adam_apply_one_with_decay.py +0 -54
- mindspore/ops/_op_impl/tbe/adam_apply_one_with_decay_assign.py +0 -54
- mindspore/ops/_op_impl/tbe/adam_apply_one_with_decay_ds.py +0 -55
- mindspore/ops/_op_impl/tbe/adaptive_max_pool2d.py +0 -37
- mindspore/ops/_op_impl/tbe/add.py +0 -42
- mindspore/ops/_op_impl/tbe/add_ds.py +0 -43
- mindspore/ops/_op_impl/tbe/add_n.py +0 -39
- mindspore/ops/_op_impl/tbe/add_n_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/addcdiv.py +0 -41
- mindspore/ops/_op_impl/tbe/addcdiv_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/addcmul.py +0 -43
- mindspore/ops/_op_impl/tbe/addcmul_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/apply_ada_max.py +0 -68
- mindspore/ops/_op_impl/tbe/apply_ada_max_ds.py +0 -69
- mindspore/ops/_op_impl/tbe/apply_adadelta.py +0 -66
- mindspore/ops/_op_impl/tbe/apply_adadelta_ds.py +0 -67
- mindspore/ops/_op_impl/tbe/apply_adagrad.py +0 -55
- mindspore/ops/_op_impl/tbe/apply_adagrad_d_a.py +0 -67
- mindspore/ops/_op_impl/tbe/apply_adagrad_ds.py +0 -56
- mindspore/ops/_op_impl/tbe/apply_adagrad_v2.py +0 -48
- mindspore/ops/_op_impl/tbe/apply_adagrad_v2_ds.py +0 -49
- mindspore/ops/_op_impl/tbe/apply_adam.py +0 -79
- mindspore/ops/_op_impl/tbe/apply_adam_ds.py +0 -80
- mindspore/ops/_op_impl/tbe/apply_adam_with_amsgrad.py +0 -60
- mindspore/ops/_op_impl/tbe/apply_adam_with_amsgrad_ds.py +0 -61
- mindspore/ops/_op_impl/tbe/apply_add_sign.py +0 -65
- mindspore/ops/_op_impl/tbe/apply_add_sign_ds.py +0 -66
- mindspore/ops/_op_impl/tbe/apply_centered_rms_prop.py +0 -77
- mindspore/ops/_op_impl/tbe/apply_centered_rms_prop_ds.py +0 -78
- mindspore/ops/_op_impl/tbe/apply_ftrl.py +0 -67
- mindspore/ops/_op_impl/tbe/apply_ftrl_ds.py +0 -68
- mindspore/ops/_op_impl/tbe/apply_gradient_descent.py +0 -44
- mindspore/ops/_op_impl/tbe/apply_gradient_descent_ds.py +0 -45
- mindspore/ops/_op_impl/tbe/apply_keras_momentum.py +0 -49
- mindspore/ops/_op_impl/tbe/apply_momentum.py +0 -64
- mindspore/ops/_op_impl/tbe/apply_momentum_ds.py +0 -65
- mindspore/ops/_op_impl/tbe/apply_power_sign.py +0 -65
- mindspore/ops/_op_impl/tbe/apply_power_sign_ds.py +0 -66
- mindspore/ops/_op_impl/tbe/apply_proximal_adagrad.py +0 -57
- mindspore/ops/_op_impl/tbe/apply_proximal_adagrad_ds.py +0 -58
- mindspore/ops/_op_impl/tbe/apply_proximal_gradient_descent.py +0 -54
- mindspore/ops/_op_impl/tbe/apply_proximal_gradient_descent_ds.py +0 -55
- mindspore/ops/_op_impl/tbe/apply_rms_prop.py +0 -52
- mindspore/ops/_op_impl/tbe/approximate_equal.py +0 -39
- mindspore/ops/_op_impl/tbe/approximate_equal_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/arg_max.py +0 -38
- mindspore/ops/_op_impl/tbe/arg_max_with_value.py +0 -38
- mindspore/ops/_op_impl/tbe/arg_max_with_value_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/arg_min.py +0 -38
- mindspore/ops/_op_impl/tbe/arg_min_v2_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/arg_min_with_value.py +0 -38
- mindspore/ops/_op_impl/tbe/arg_min_with_value_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/asin.py +0 -37
- mindspore/ops/_op_impl/tbe/asin_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/asin_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/asin_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/asinh.py +0 -37
- mindspore/ops/_op_impl/tbe/asinh_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/asinh_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/asinh_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/assign.py +0 -79
- mindspore/ops/_op_impl/tbe/assign_add.py +0 -59
- mindspore/ops/_op_impl/tbe/assign_add_ds.py +0 -60
- mindspore/ops/_op_impl/tbe/assign_ds.py +0 -80
- mindspore/ops/_op_impl/tbe/assign_sub.py +0 -55
- mindspore/ops/_op_impl/tbe/assign_sub_ds.py +0 -56
- mindspore/ops/_op_impl/tbe/atan.py +0 -37
- mindspore/ops/_op_impl/tbe/atan2.py +0 -38
- mindspore/ops/_op_impl/tbe/atan2_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/atan_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/atan_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/atan_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/atanh.py +0 -37
- mindspore/ops/_op_impl/tbe/atanh_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/avg_pool.py +0 -43
- mindspore/ops/_op_impl/tbe/avg_pool_3d.py +0 -44
- mindspore/ops/_op_impl/tbe/avg_pool_3d_grad.py +0 -45
- mindspore/ops/_op_impl/tbe/avg_pool_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/avg_pool_grad.py +0 -42
- mindspore/ops/_op_impl/tbe/avg_pool_grad_vm.py +0 -42
- mindspore/ops/_op_impl/tbe/basic_lstm_cell.py +0 -57
- mindspore/ops/_op_impl/tbe/basic_lstm_cell_c_state_grad.py +0 -50
- mindspore/ops/_op_impl/tbe/basic_lstm_cell_c_state_grad_v2.py +0 -51
- mindspore/ops/_op_impl/tbe/basic_lstm_cell_input_grad.py +0 -42
- mindspore/ops/_op_impl/tbe/basic_lstm_cell_weight_grad.py +0 -41
- mindspore/ops/_op_impl/tbe/batch_matmul.py +0 -42
- mindspore/ops/_op_impl/tbe/batch_matmul_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/batch_matmul_v2.py +0 -47
- mindspore/ops/_op_impl/tbe/batch_to_space.py +0 -38
- mindspore/ops/_op_impl/tbe/batch_to_space_nd.py +0 -38
- mindspore/ops/_op_impl/tbe/batch_to_space_nd_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/batch_to_space_nd_v2.py +0 -41
- mindspore/ops/_op_impl/tbe/batchnorm.py +0 -58
- mindspore/ops/_op_impl/tbe/batchnorm_grad.py +0 -58
- mindspore/ops/_op_impl/tbe/bce_with_logits_loss.py +0 -42
- mindspore/ops/_op_impl/tbe/bessel_i0e.py +0 -37
- mindspore/ops/_op_impl/tbe/bessel_i0e_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/bessel_i1e.py +0 -37
- mindspore/ops/_op_impl/tbe/bessel_i1e_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/bias_add.py +0 -38
- mindspore/ops/_op_impl/tbe/bias_add_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/bias_add_grad.py +0 -53
- mindspore/ops/_op_impl/tbe/binary_cross_entropy.py +0 -39
- mindspore/ops/_op_impl/tbe/binary_cross_entropy_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/binary_cross_entropy_grad.py +0 -44
- mindspore/ops/_op_impl/tbe/binary_cross_entropy_grad_ds.py +0 -45
- mindspore/ops/_op_impl/tbe/bitwise_and.py +0 -39
- mindspore/ops/_op_impl/tbe/bitwise_and_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/bitwise_or.py +0 -39
- mindspore/ops/_op_impl/tbe/bitwise_or_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/bitwise_xor.py +0 -39
- mindspore/ops/_op_impl/tbe/bitwise_xor_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/bn_infer.py +0 -43
- mindspore/ops/_op_impl/tbe/bn_infer_ds.py +0 -45
- mindspore/ops/_op_impl/tbe/bn_infer_grad.py +0 -41
- mindspore/ops/_op_impl/tbe/bn_infer_grad_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/bn_inference.py +0 -50
- mindspore/ops/_op_impl/tbe/bn_training_reduce.py +0 -38
- mindspore/ops/_op_impl/tbe/bn_training_reduce_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/bn_training_reduce_grad.py +0 -46
- mindspore/ops/_op_impl/tbe/bn_training_reduce_grad_ds.py +0 -47
- mindspore/ops/_op_impl/tbe/bn_training_update.py +0 -52
- mindspore/ops/_op_impl/tbe/bn_training_update_ds.py +0 -53
- mindspore/ops/_op_impl/tbe/bn_training_update_grad.py +0 -44
- mindspore/ops/_op_impl/tbe/bn_training_update_grad_ds.py +0 -45
- mindspore/ops/_op_impl/tbe/bn_training_update_v2.py +0 -48
- mindspore/ops/_op_impl/tbe/bn_training_update_v3.py +0 -51
- mindspore/ops/_op_impl/tbe/bounding_box_decode.py +0 -41
- mindspore/ops/_op_impl/tbe/bounding_box_decode_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/bounding_box_encode.py +0 -38
- mindspore/ops/_op_impl/tbe/broadcast_to.py +0 -40
- mindspore/ops/_op_impl/tbe/broadcast_to_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/cast.py +0 -55
- mindspore/ops/_op_impl/tbe/cast_ds.py +0 -58
- mindspore/ops/_op_impl/tbe/cdist.py +0 -38
- mindspore/ops/_op_impl/tbe/cdist_grad.py +0 -42
- mindspore/ops/_op_impl/tbe/ceil.py +0 -37
- mindspore/ops/_op_impl/tbe/ceil_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/celu.py +0 -39
- mindspore/ops/_op_impl/tbe/centralization.py +0 -39
- mindspore/ops/_op_impl/tbe/check_valid.py +0 -38
- mindspore/ops/_op_impl/tbe/check_valid_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/clip_by_norm_no_div_sum.py +0 -41
- mindspore/ops/_op_impl/tbe/clip_by_norm_no_div_sum_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/clip_by_value.py +0 -41
- mindspore/ops/_op_impl/tbe/clip_by_value_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/concat.py +0 -40
- mindspore/ops/_op_impl/tbe/concat_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/confusion_matrix.py +0 -63
- mindspore/ops/_op_impl/tbe/confusion_mul_grad.py +0 -40
- mindspore/ops/_op_impl/tbe/confusion_softmax_grad.py +0 -41
- mindspore/ops/_op_impl/tbe/confusion_transpose_d.py +0 -39
- mindspore/ops/_op_impl/tbe/conv2d.py +0 -47
- mindspore/ops/_op_impl/tbe/conv2d_backprop_filter.py +0 -42
- mindspore/ops/_op_impl/tbe/conv2d_backprop_filter_ds.py +0 -43
- mindspore/ops/_op_impl/tbe/conv2d_backprop_input.py +0 -42
- mindspore/ops/_op_impl/tbe/conv2d_backprop_input_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/conv2d_ds.py +0 -47
- mindspore/ops/_op_impl/tbe/conv2d_transpose.py +0 -48
- mindspore/ops/_op_impl/tbe/conv3d.py +0 -45
- mindspore/ops/_op_impl/tbe/conv3d_backprop_filter.py +0 -42
- mindspore/ops/_op_impl/tbe/conv3d_backprop_input.py +0 -42
- mindspore/ops/_op_impl/tbe/conv3d_transpose.py +0 -47
- mindspore/ops/_op_impl/tbe/conv3d_transpose_ds.py +0 -48
- mindspore/ops/_op_impl/tbe/cos.py +0 -37
- mindspore/ops/_op_impl/tbe/cos_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/cosh.py +0 -37
- mindspore/ops/_op_impl/tbe/cosh_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/ctc_loss_v2.py +0 -42
- mindspore/ops/_op_impl/tbe/ctc_loss_v2_grad.py +0 -44
- mindspore/ops/_op_impl/tbe/cum_sum.py +0 -42
- mindspore/ops/_op_impl/tbe/cum_sum_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/cummin.py +0 -41
- mindspore/ops/_op_impl/tbe/cumprod.py +0 -42
- mindspore/ops/_op_impl/tbe/data_format_dim_map.py +0 -38
- mindspore/ops/_op_impl/tbe/data_format_dim_map_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/deformable_offsets.py +0 -45
- mindspore/ops/_op_impl/tbe/deformable_offsets_grad.py +0 -48
- mindspore/ops/_op_impl/tbe/depth_to_space_ds.py +0 -49
- mindspore/ops/_op_impl/tbe/depthwise_conv2d.py +0 -44
- mindspore/ops/_op_impl/tbe/depthwise_conv2d_backprop_filter.py +0 -41
- mindspore/ops/_op_impl/tbe/depthwise_conv2d_backprop_input.py +0 -41
- mindspore/ops/_op_impl/tbe/diag.py +0 -38
- mindspore/ops/_op_impl/tbe/diag_part.py +0 -38
- mindspore/ops/_op_impl/tbe/dilation.py +0 -40
- mindspore/ops/_op_impl/tbe/div.py +0 -41
- mindspore/ops/_op_impl/tbe/div_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/div_no_nan.py +0 -41
- mindspore/ops/_op_impl/tbe/div_no_nan_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/dropout_do_mask.py +0 -38
- mindspore/ops/_op_impl/tbe/dropout_do_mask_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/dropout_do_mask_v3.py +0 -39
- mindspore/ops/_op_impl/tbe/dynamic_atomic_addr_clean.py +0 -34
- mindspore/ops/_op_impl/tbe/dynamic_gru_v2.py +0 -95
- mindspore/ops/_op_impl/tbe/dynamic_rnn.py +0 -82
- mindspore/ops/_op_impl/tbe/elu.py +0 -38
- mindspore/ops/_op_impl/tbe/elu_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/elu_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/elu_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/equal.py +0 -42
- mindspore/ops/_op_impl/tbe/equal_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/erf.py +0 -37
- mindspore/ops/_op_impl/tbe/erf_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/erfc.py +0 -37
- mindspore/ops/_op_impl/tbe/erfc_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/erfinv.py +0 -36
- mindspore/ops/_op_impl/tbe/exp.py +0 -40
- mindspore/ops/_op_impl/tbe/exp_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/expand_dims.py +0 -38
- mindspore/ops/_op_impl/tbe/expm1.py +0 -37
- mindspore/ops/_op_impl/tbe/expm1_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/extract_image_patches.py +0 -41
- mindspore/ops/_op_impl/tbe/extract_volume_patches.py +0 -39
- mindspore/ops/_op_impl/tbe/fake_quant_with_min_max_vars.py +0 -39
- mindspore/ops/_op_impl/tbe/fake_quant_with_min_max_vars_gradient.py +0 -43
- mindspore/ops/_op_impl/tbe/fake_quant_with_min_max_vars_per_channel.py +0 -39
- mindspore/ops/_op_impl/tbe/fake_quant_with_min_max_vars_per_channel_gradient.py +0 -43
- mindspore/ops/_op_impl/tbe/fast_gelu.py +0 -37
- mindspore/ops/_op_impl/tbe/fast_gelu_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/fast_gelu_grad.py +0 -41
- mindspore/ops/_op_impl/tbe/fast_gelu_grad_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/fill.py +0 -56
- mindspore/ops/_op_impl/tbe/fill_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/flatten.py +0 -48
- mindspore/ops/_op_impl/tbe/floor.py +0 -37
- mindspore/ops/_op_impl/tbe/floor_div.py +0 -41
- mindspore/ops/_op_impl/tbe/floor_div_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/floor_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/floor_mod.py +0 -39
- mindspore/ops/_op_impl/tbe/floor_mod_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/fused_dbn_dw.py +0 -52
- mindspore/ops/_op_impl/tbe/fused_mul_add.py +0 -38
- mindspore/ops/_op_impl/tbe/fused_mul_add_n.py +0 -48
- mindspore/ops/_op_impl/tbe/fused_mul_add_n_l2loss.py +0 -53
- mindspore/ops/_op_impl/tbe/fused_mul_apply_momentum.py +0 -57
- mindspore/ops/_op_impl/tbe/fused_mul_apply_momentum_extern.py +0 -67
- mindspore/ops/_op_impl/tbe/gather_nd.py +0 -52
- mindspore/ops/_op_impl/tbe/gather_nd_ds.py +0 -48
- mindspore/ops/_op_impl/tbe/gather_v2.py +0 -56
- mindspore/ops/_op_impl/tbe/gather_v2_ds.py +0 -68
- mindspore/ops/_op_impl/tbe/gelu.py +0 -37
- mindspore/ops/_op_impl/tbe/gelu_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/gelu_grad.py +0 -42
- mindspore/ops/_op_impl/tbe/gelu_grad_ds.py +0 -43
- mindspore/ops/_op_impl/tbe/ger.py +0 -43
- mindspore/ops/_op_impl/tbe/ger_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/greater.py +0 -43
- mindspore/ops/_op_impl/tbe/greater_equal.py +0 -41
- mindspore/ops/_op_impl/tbe/greater_equal_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/gru_v2_hidden_grad.py +0 -51
- mindspore/ops/_op_impl/tbe/gru_v2_hidden_grad_cell.py +0 -52
- mindspore/ops/_op_impl/tbe/hard_swish.py +0 -37
- mindspore/ops/_op_impl/tbe/hard_swish_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/hard_swish_grad.py +0 -41
- mindspore/ops/_op_impl/tbe/hard_swish_grad_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/histogram_fixed_width.py +0 -40
- mindspore/ops/_op_impl/tbe/hshrink.py +0 -33
- mindspore/ops/_op_impl/tbe/hshrink_grad.py +0 -37
- mindspore/ops/_op_impl/tbe/hsigmoid.py +0 -45
- mindspore/ops/_op_impl/tbe/hsigmoid_grad.py +0 -39
- mindspore/ops/_op_impl/tbe/ifmr.py +0 -47
- mindspore/ops/_op_impl/tbe/ifmr_ds.py +0 -48
- mindspore/ops/_op_impl/tbe/im2col.py +0 -42
- mindspore/ops/_op_impl/tbe/in_top_k.py +0 -37
- mindspore/ops/_op_impl/tbe/inplace_add.py +0 -39
- mindspore/ops/_op_impl/tbe/inplace_index_add.py +0 -46
- mindspore/ops/_op_impl/tbe/inplace_sub.py +0 -39
- mindspore/ops/_op_impl/tbe/inplace_update.py +0 -39
- mindspore/ops/_op_impl/tbe/inplace_update_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/inv.py +0 -38
- mindspore/ops/_op_impl/tbe/inv_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/inv_grad.py +0 -40
- mindspore/ops/_op_impl/tbe/inv_grad_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/invert.py +0 -37
- mindspore/ops/_op_impl/tbe/invert_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/iou.py +0 -38
- mindspore/ops/_op_impl/tbe/iou_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/is_close.py +0 -40
- mindspore/ops/_op_impl/tbe/kl_div_loss.py +0 -38
- mindspore/ops/_op_impl/tbe/kl_div_loss_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/kl_div_loss_grad.py +0 -40
- mindspore/ops/_op_impl/tbe/l2_loss.py +0 -36
- mindspore/ops/_op_impl/tbe/l2_loss_ds.py +0 -37
- mindspore/ops/_op_impl/tbe/l2_normalize.py +0 -38
- mindspore/ops/_op_impl/tbe/l2_normalize_grad.py +0 -40
- mindspore/ops/_op_impl/tbe/lamb_apply_optimizer_assign.py +0 -55
- mindspore/ops/_op_impl/tbe/lamb_apply_weight_assign.py +0 -42
- mindspore/ops/_op_impl/tbe/lamb_next_mv.py +0 -59
- mindspore/ops/_op_impl/tbe/lamb_next_mv_with_decay.py +0 -59
- mindspore/ops/_op_impl/tbe/lamb_next_right.py +0 -44
- mindspore/ops/_op_impl/tbe/lamb_update_with_lr.py +0 -48
- mindspore/ops/_op_impl/tbe/lamb_update_with_lr_v2.py +0 -44
- mindspore/ops/_op_impl/tbe/lars_update.py +0 -50
- mindspore/ops/_op_impl/tbe/lars_update_ds.py +0 -51
- mindspore/ops/_op_impl/tbe/layer_norm.py +0 -46
- mindspore/ops/_op_impl/tbe/layer_norm_beta_gamma_backprop.py +0 -44
- mindspore/ops/_op_impl/tbe/layer_norm_beta_gamma_backprop_ds.py +0 -45
- mindspore/ops/_op_impl/tbe/layer_norm_beta_gamma_backprop_v2.py +0 -40
- mindspore/ops/_op_impl/tbe/layer_norm_beta_gamma_backprop_v2_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/layer_norm_ds.py +0 -47
- mindspore/ops/_op_impl/tbe/layer_norm_grad.py +0 -48
- mindspore/ops/_op_impl/tbe/layer_norm_x_backprop.py +0 -43
- mindspore/ops/_op_impl/tbe/layer_norm_x_backprop_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/layer_norm_x_backprop_v2.py +0 -45
- mindspore/ops/_op_impl/tbe/layer_norm_x_backprop_v2_ds.py +0 -45
- mindspore/ops/_op_impl/tbe/lerp.py +0 -38
- mindspore/ops/_op_impl/tbe/less.py +0 -41
- mindspore/ops/_op_impl/tbe/less_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/less_equal.py +0 -41
- mindspore/ops/_op_impl/tbe/less_equal_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/log.py +0 -40
- mindspore/ops/_op_impl/tbe/log1p.py +0 -37
- mindspore/ops/_op_impl/tbe/log1p_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/log_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/logical_and.py +0 -37
- mindspore/ops/_op_impl/tbe/logical_and_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/logical_not.py +0 -36
- mindspore/ops/_op_impl/tbe/logical_not_ds.py +0 -37
- mindspore/ops/_op_impl/tbe/logical_or.py +0 -37
- mindspore/ops/_op_impl/tbe/logical_or_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/logsoftmax.py +0 -37
- mindspore/ops/_op_impl/tbe/logsoftmax_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/logsoftmax_grad.py +0 -38
- mindspore/ops/_op_impl/tbe/logsoftmax_grad_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/lp_norm.py +0 -40
- mindspore/ops/_op_impl/tbe/lp_norm_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/lrn.py +0 -41
- mindspore/ops/_op_impl/tbe/lrn_grad.py +0 -42
- mindspore/ops/_op_impl/tbe/lstm_input_grad.py +0 -51
- mindspore/ops/_op_impl/tbe/masked_fill.py +0 -40
- mindspore/ops/_op_impl/tbe/masked_fill_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/matmul.py +0 -53
- mindspore/ops/_op_impl/tbe/matmul_ds.py +0 -47
- mindspore/ops/_op_impl/tbe/matmul_v2.py +0 -50
- mindspore/ops/_op_impl/tbe/matrix_diag.py +0 -45
- mindspore/ops/_op_impl/tbe/matrix_diag_part.py +0 -45
- mindspore/ops/_op_impl/tbe/matrix_set_diag.py +0 -46
- mindspore/ops/_op_impl/tbe/max_pool.py +0 -39
- mindspore/ops/_op_impl/tbe/max_pool3d.py +0 -44
- mindspore/ops/_op_impl/tbe/max_pool3d_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/max_pool3d_grad_grad.py +0 -44
- mindspore/ops/_op_impl/tbe/max_pool_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/max_pool_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/max_pool_grad_grad.py +0 -41
- mindspore/ops/_op_impl/tbe/max_pool_grad_grad_with_argmax.py +0 -41
- mindspore/ops/_op_impl/tbe/max_pool_grad_with_argmax.py +0 -42
- mindspore/ops/_op_impl/tbe/max_pool_with_argmax.py +0 -40
- mindspore/ops/_op_impl/tbe/maximum.py +0 -39
- mindspore/ops/_op_impl/tbe/maximum_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/maximum_grad.py +0 -46
- mindspore/ops/_op_impl/tbe/maximum_grad_ds.py +0 -47
- mindspore/ops/_op_impl/tbe/mem_set.py +0 -38
- mindspore/ops/_op_impl/tbe/minimum.py +0 -40
- mindspore/ops/_op_impl/tbe/minimum_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/minimum_grad.py +0 -46
- mindspore/ops/_op_impl/tbe/minimum_grad_ds.py +0 -47
- mindspore/ops/_op_impl/tbe/mish.py +0 -37
- mindspore/ops/_op_impl/tbe/mod.py +0 -41
- mindspore/ops/_op_impl/tbe/mod_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/mul.py +0 -37
- mindspore/ops/_op_impl/tbe/mul_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/mul_no_nan.py +0 -39
- mindspore/ops/_op_impl/tbe/mul_no_nan_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/multilabel_margin_loss.py +0 -39
- mindspore/ops/_op_impl/tbe/neg.py +0 -39
- mindspore/ops/_op_impl/tbe/neg_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/new_im2col.py +0 -40
- mindspore/ops/_op_impl/tbe/nll_loss.py +0 -41
- mindspore/ops/_op_impl/tbe/nll_loss_grad.py +0 -44
- mindspore/ops/_op_impl/tbe/nms_with_mask.py +0 -39
- mindspore/ops/_op_impl/tbe/not_equal.py +0 -41
- mindspore/ops/_op_impl/tbe/not_equal_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/npu_alloc_float_status.py +0 -34
- mindspore/ops/_op_impl/tbe/npu_clear_float_status.py +0 -35
- mindspore/ops/_op_impl/tbe/npu_clear_float_status_v2.py +0 -35
- mindspore/ops/_op_impl/tbe/npu_get_float_status.py +0 -35
- mindspore/ops/_op_impl/tbe/npu_get_float_status_v2.py +0 -35
- mindspore/ops/_op_impl/tbe/one_hot.py +0 -48
- mindspore/ops/_op_impl/tbe/one_hot_ds.py +0 -45
- mindspore/ops/_op_impl/tbe/ones_like.py +0 -40
- mindspore/ops/_op_impl/tbe/ones_like_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/p_s_r_o_i_pooling.py +0 -40
- mindspore/ops/_op_impl/tbe/p_s_r_o_i_pooling_grad.py +0 -40
- mindspore/ops/_op_impl/tbe/pack.py +0 -58
- mindspore/ops/_op_impl/tbe/pack_ds.py +0 -59
- mindspore/ops/_op_impl/tbe/pad_d.py +0 -40
- mindspore/ops/_op_impl/tbe/pad_d_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/parallel_concat.py +0 -70
- mindspore/ops/_op_impl/tbe/parallel_resize_bilinear.py +0 -45
- mindspore/ops/_op_impl/tbe/parallel_resize_bilinear_grad.py +0 -44
- mindspore/ops/_op_impl/tbe/pdist.py +0 -36
- mindspore/ops/_op_impl/tbe/pooling.py +0 -46
- mindspore/ops/_op_impl/tbe/population_count.py +0 -38
- mindspore/ops/_op_impl/tbe/pow.py +0 -41
- mindspore/ops/_op_impl/tbe/pow_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/prelu.py +0 -37
- mindspore/ops/_op_impl/tbe/prelu_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/prelu_grad.py +0 -40
- mindspore/ops/_op_impl/tbe/range.py +0 -39
- mindspore/ops/_op_impl/tbe/real_div.py +0 -38
- mindspore/ops/_op_impl/tbe/real_div_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/reciprocal.py +0 -36
- mindspore/ops/_op_impl/tbe/reciprocal_ds.py +0 -37
- mindspore/ops/_op_impl/tbe/reciprocal_grad.py +0 -38
- mindspore/ops/_op_impl/tbe/reciprocal_grad_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/reduce_all.py +0 -38
- mindspore/ops/_op_impl/tbe/reduce_all_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/reduce_any.py +0 -38
- mindspore/ops/_op_impl/tbe/reduce_any_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/reduce_max.py +0 -43
- mindspore/ops/_op_impl/tbe/reduce_max_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/reduce_mean.py +0 -40
- mindspore/ops/_op_impl/tbe/reduce_mean_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/reduce_min.py +0 -41
- mindspore/ops/_op_impl/tbe/reduce_min_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/reduce_prod.py +0 -42
- mindspore/ops/_op_impl/tbe/reduce_prod_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/reduce_std.py +0 -44
- mindspore/ops/_op_impl/tbe/reduce_sum.py +0 -39
- mindspore/ops/_op_impl/tbe/reduce_sum_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/relu.py +0 -39
- mindspore/ops/_op_impl/tbe/relu6.py +0 -38
- mindspore/ops/_op_impl/tbe/relu6_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/relu6_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/relu6_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/relu_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/relu_grad.py +0 -41
- mindspore/ops/_op_impl/tbe/relu_grad_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/relu_grad_v2.py +0 -40
- mindspore/ops/_op_impl/tbe/relu_grad_v2_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/relu_v2.py +0 -40
- mindspore/ops/_op_impl/tbe/relu_v2_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/renorm.py +0 -39
- mindspore/ops/_op_impl/tbe/resize_bilinear.py +0 -40
- mindspore/ops/_op_impl/tbe/resize_bilinear_grad.py +0 -41
- mindspore/ops/_op_impl/tbe/resize_bilinear_v2.py +0 -43
- mindspore/ops/_op_impl/tbe/resize_nearest_neighbor.py +0 -40
- mindspore/ops/_op_impl/tbe/resize_nearest_neighbor_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/resize_nearest_neighbor_grad.py +0 -39
- mindspore/ops/_op_impl/tbe/resize_nearest_neighbor_grad_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/reverse_v2_d.py +0 -37
- mindspore/ops/_op_impl/tbe/rint.py +0 -37
- mindspore/ops/_op_impl/tbe/rint_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/roi_align.py +0 -43
- mindspore/ops/_op_impl/tbe/roi_align_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/roi_align_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/roi_align_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/roll.py +0 -42
- mindspore/ops/_op_impl/tbe/round.py +0 -38
- mindspore/ops/_op_impl/tbe/round_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/rsqrt.py +0 -37
- mindspore/ops/_op_impl/tbe/rsqrt_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/rsqrt_grad.py +0 -40
- mindspore/ops/_op_impl/tbe/rsqrt_grad_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/scatter_add.py +0 -44
- mindspore/ops/_op_impl/tbe/scatter_div.py +0 -46
- mindspore/ops/_op_impl/tbe/scatter_max.py +0 -45
- mindspore/ops/_op_impl/tbe/scatter_min.py +0 -45
- mindspore/ops/_op_impl/tbe/scatter_mul.py +0 -44
- mindspore/ops/_op_impl/tbe/scatter_nd.py +0 -41
- mindspore/ops/_op_impl/tbe/scatter_nd_add.py +0 -45
- mindspore/ops/_op_impl/tbe/scatter_nd_d.py +0 -41
- mindspore/ops/_op_impl/tbe/scatter_nd_ds.py +0 -49
- mindspore/ops/_op_impl/tbe/scatter_nd_sub.py +0 -47
- mindspore/ops/_op_impl/tbe/scatter_nd_sub_ds.py +0 -48
- mindspore/ops/_op_impl/tbe/scatter_nd_update.py +0 -47
- mindspore/ops/_op_impl/tbe/scatter_nd_update_ds.py +0 -48
- mindspore/ops/_op_impl/tbe/scatter_non_aliasing_add.py +0 -39
- mindspore/ops/_op_impl/tbe/scatter_non_aliasing_add_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/scatter_sub.py +0 -47
- mindspore/ops/_op_impl/tbe/scatter_sub_ds.py +0 -48
- mindspore/ops/_op_impl/tbe/scatter_update.py +0 -43
- mindspore/ops/_op_impl/tbe/select.py +0 -38
- mindspore/ops/_op_impl/tbe/select_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/selu.py +0 -39
- mindspore/ops/_op_impl/tbe/selu_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/sgd.py +0 -62
- mindspore/ops/_op_impl/tbe/sigmoid.py +0 -37
- mindspore/ops/_op_impl/tbe/sigmoid_cross_entropy_with_logits.py +0 -41
- mindspore/ops/_op_impl/tbe/sigmoid_cross_entropy_with_logits_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/sigmoid_cross_entropy_with_logits_grad.py +0 -42
- mindspore/ops/_op_impl/tbe/sigmoid_cross_entropy_with_logits_grad_ds.py +0 -43
- mindspore/ops/_op_impl/tbe/sigmoid_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/sigmoid_grad.py +0 -39
- mindspore/ops/_op_impl/tbe/sigmoid_grad_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/sign.py +0 -38
- mindspore/ops/_op_impl/tbe/sign_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/sin.py +0 -37
- mindspore/ops/_op_impl/tbe/sin_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/sinh.py +0 -37
- mindspore/ops/_op_impl/tbe/sinh_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/slice.py +0 -58
- mindspore/ops/_op_impl/tbe/smooth_l1_loss.py +0 -45
- mindspore/ops/_op_impl/tbe/smooth_l1_loss_ds.py +0 -46
- mindspore/ops/_op_impl/tbe/smooth_l1_loss_grad.py +0 -46
- mindspore/ops/_op_impl/tbe/smooth_l1_loss_grad_ds.py +0 -47
- mindspore/ops/_op_impl/tbe/soft_margin_loss.py +0 -38
- mindspore/ops/_op_impl/tbe/soft_margin_loss_grad.py +0 -39
- mindspore/ops/_op_impl/tbe/soft_shrink.py +0 -36
- mindspore/ops/_op_impl/tbe/soft_shrink_grad.py +0 -38
- mindspore/ops/_op_impl/tbe/softmax.py +0 -37
- mindspore/ops/_op_impl/tbe/softmax_cross_entropy_with_logits.py +0 -38
- mindspore/ops/_op_impl/tbe/softmax_cross_entropy_with_logits_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/softmax_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/softmax_grad_ext.py +0 -42
- mindspore/ops/_op_impl/tbe/softmax_v2_with_dropout_do_mask_v3.py +0 -39
- mindspore/ops/_op_impl/tbe/softplus.py +0 -37
- mindspore/ops/_op_impl/tbe/softplus_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/softplus_grad.py +0 -38
- mindspore/ops/_op_impl/tbe/softplus_grad_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/softsign.py +0 -37
- mindspore/ops/_op_impl/tbe/softsign_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/sort.py +0 -38
- mindspore/ops/_op_impl/tbe/sort_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/space_to_batch.py +0 -38
- mindspore/ops/_op_impl/tbe/space_to_batch_nd.py +0 -38
- mindspore/ops/_op_impl/tbe/space_to_depth.py +0 -47
- mindspore/ops/_op_impl/tbe/sparse_apply_adadelta.py +0 -56
- mindspore/ops/_op_impl/tbe/sparse_apply_adagrad.py +0 -45
- mindspore/ops/_op_impl/tbe/sparse_apply_adagrad_ds.py +0 -46
- mindspore/ops/_op_impl/tbe/sparse_apply_adagrad_v2.py +0 -46
- mindspore/ops/_op_impl/tbe/sparse_apply_adagrad_v2_ds.py +0 -47
- mindspore/ops/_op_impl/tbe/sparse_apply_ftrl_d.py +0 -53
- mindspore/ops/_op_impl/tbe/sparse_apply_ftrl_d_ds.py +0 -50
- mindspore/ops/_op_impl/tbe/sparse_apply_ftrl_v2.py +0 -50
- mindspore/ops/_op_impl/tbe/sparse_apply_proximal_adagrad.py +0 -66
- mindspore/ops/_op_impl/tbe/sparse_apply_proximal_adagrad_ds.py +0 -67
- mindspore/ops/_op_impl/tbe/sparse_apply_r_m_s_prop.py +0 -57
- mindspore/ops/_op_impl/tbe/sparse_apply_r_m_s_prop_ds.py +0 -58
- mindspore/ops/_op_impl/tbe/sparse_gather_v2.py +0 -56
- mindspore/ops/_op_impl/tbe/sparse_gather_v2_ds.py +0 -58
- mindspore/ops/_op_impl/tbe/split_d.py +0 -38
- mindspore/ops/_op_impl/tbe/split_d_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/split_v.py +0 -39
- mindspore/ops/_op_impl/tbe/splitv.py +0 -39
- mindspore/ops/_op_impl/tbe/sqrt.py +0 -37
- mindspore/ops/_op_impl/tbe/sqrt_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/sqrt_grad.py +0 -43
- mindspore/ops/_op_impl/tbe/sqrt_grad_ds.py +0 -44
- mindspore/ops/_op_impl/tbe/square.py +0 -38
- mindspore/ops/_op_impl/tbe/square_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/square_sum_all.py +0 -40
- mindspore/ops/_op_impl/tbe/square_sum_all_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/square_sum_v1.py +0 -38
- mindspore/ops/_op_impl/tbe/square_sum_v1_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/square_sum_v2.py +0 -39
- mindspore/ops/_op_impl/tbe/squared_difference.py +0 -39
- mindspore/ops/_op_impl/tbe/squared_difference_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/squeeze.py +0 -37
- mindspore/ops/_op_impl/tbe/strided_read.py +0 -38
- mindspore/ops/_op_impl/tbe/strided_slice_d.py +0 -44
- mindspore/ops/_op_impl/tbe/strided_slice_ds.py +0 -71
- mindspore/ops/_op_impl/tbe/strided_slice_grad_d.py +0 -51
- mindspore/ops/_op_impl/tbe/strided_slice_grad_ds.py +0 -57
- mindspore/ops/_op_impl/tbe/strided_write.py +0 -38
- mindspore/ops/_op_impl/tbe/sub.py +0 -39
- mindspore/ops/_op_impl/tbe/sub_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/tan.py +0 -38
- mindspore/ops/_op_impl/tbe/tan_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/tanh.py +0 -37
- mindspore/ops/_op_impl/tbe/tanh_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/tanh_grad.py +0 -39
- mindspore/ops/_op_impl/tbe/tanh_grad_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/tensor_move.py +0 -49
- mindspore/ops/_op_impl/tbe/tensor_move_ds.py +0 -50
- mindspore/ops/_op_impl/tbe/tensor_scatter_update.py +0 -41
- mindspore/ops/_op_impl/tbe/tile.py +0 -37
- mindspore/ops/_op_impl/tbe/tile_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/top_k.py +0 -42
- mindspore/ops/_op_impl/tbe/top_k_ds.py +0 -43
- mindspore/ops/_op_impl/tbe/trans_data.py +0 -167
- mindspore/ops/_op_impl/tbe/trans_data_ds.py +0 -180
- mindspore/ops/_op_impl/tbe/trans_data_rnn.py +0 -44
- mindspore/ops/_op_impl/tbe/transpose.py +0 -60
- mindspore/ops/_op_impl/tbe/transpose_d.py +0 -47
- mindspore/ops/_op_impl/tbe/transpose_nod.py +0 -60
- mindspore/ops/_op_impl/tbe/trunc.py +0 -39
- mindspore/ops/_op_impl/tbe/truncate_div.py +0 -41
- mindspore/ops/_op_impl/tbe/truncate_div_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/truncate_mod.py +0 -41
- mindspore/ops/_op_impl/tbe/truncate_mod_ds.py +0 -42
- mindspore/ops/_op_impl/tbe/unpack.py +0 -38
- mindspore/ops/_op_impl/tbe/unpack_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/unsorted_segment_max.py +0 -49
- mindspore/ops/_op_impl/tbe/unsorted_segment_max_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/unsorted_segment_min.py +0 -49
- mindspore/ops/_op_impl/tbe/unsorted_segment_min_ds.py +0 -40
- mindspore/ops/_op_impl/tbe/unsorted_segment_prod.py +0 -49
- mindspore/ops/_op_impl/tbe/unsorted_segment_prod_ds.py +0 -38
- mindspore/ops/_op_impl/tbe/unsorted_segment_sum.py +0 -38
- mindspore/ops/_op_impl/tbe/unsorted_segment_sum_ds.py +0 -41
- mindspore/ops/_op_impl/tbe/wts_arq.py +0 -40
- mindspore/ops/_op_impl/tbe/xdivy.py +0 -38
- mindspore/ops/_op_impl/tbe/xdivy_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/xlogy.py +0 -38
- mindspore/ops/_op_impl/tbe/xlogy_ds.py +0 -39
- mindspore/ops/_op_impl/tbe/zeros_like.py +0 -41
- mindspore/ops/_op_impl/tbe/zeros_like_ds.py +0 -42
- mindspore/ops/_tracefunc.py +0 -241
- mindspore/ops/arg_dtype_cast.py +0 -54
- mindspore/ops/silent_check.py +0 -162
- mindspore/profiler/parser/msadvisor_analyzer.py +0 -82
- mindspore/profiler/parser/msadvisor_parser.py +0 -240
- mindspore/rewrite/api/tree_node_helper.py +0 -60
- mindspore/rewrite/ast_helpers/ast_creator.py +0 -115
- mindspore/rewrite/ast_transformers/flatten_recursive_stmt.py +0 -267
- mindspore/rewrite/ast_transformers/remove_return_out_of_if.py +0 -228
- mindspore/rewrite/namespace.py +0 -53
- mindspore-2.2.14.dist-info/RECORD +0 -1924
- {mindspore-2.2.14.dist-info → mindspore-2.4.0.dist-info}/WHEEL +0 -0
- {mindspore-2.2.14.dist-info → mindspore-2.4.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,1701 @@
|
|
|
1
|
+
# Copyright 2023 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
|
+
|
|
16
|
+
from mindspore.common import dtype as mstype
|
|
17
|
+
from mindspore.ops.auto_generate.pyboost_inner_prim import *
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def acos(input):
|
|
21
|
+
r"""
|
|
22
|
+
Computes arccosine of input tensors element-wise.
|
|
23
|
+
|
|
24
|
+
.. math::
|
|
25
|
+
|
|
26
|
+
out_i = \cos^{-1}(input_i)
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
input (Tensor): The shape of tensor is
|
|
30
|
+
:math:`(N,*)`, where :math:`*` means any number of additional dimensions.
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
Tensor, has the same shape as `input`. The dtype of output is float32 when dtype of `input` is in [bool, int8, uint8, int16, int32, int64]. Otherwise output has the same dtype as `input`.
|
|
34
|
+
|
|
35
|
+
Raises:
|
|
36
|
+
TypeError: If `input` is not a Tensor.
|
|
37
|
+
|
|
38
|
+
Supported Platforms:
|
|
39
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
>>> import mindspore
|
|
43
|
+
>>> import numpy as np
|
|
44
|
+
>>> from mindspore import Tensor, ops
|
|
45
|
+
>>> input = Tensor(np.array([0.74, 0.04, 0.30, 0.56]), mindspore.float32)
|
|
46
|
+
>>> output = ops.acos_ext(input)
|
|
47
|
+
>>> print(output)
|
|
48
|
+
[0.7377037 1.5307857 1.2661037 0.9764114]
|
|
49
|
+
"""
|
|
50
|
+
return acos_impl(input)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def acosh(input):
|
|
54
|
+
r"""
|
|
55
|
+
Computes inverse hyperbolic cosine of the inputs element-wise.
|
|
56
|
+
|
|
57
|
+
.. math::
|
|
58
|
+
|
|
59
|
+
out_i = \cosh^{-1}(input_i)
|
|
60
|
+
|
|
61
|
+
.. note::
|
|
62
|
+
Given an input tensor input, the function computes inverse hyperbolic cosine of every element.
|
|
63
|
+
Input range is [1, inf].
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
input (Tensor): The input tensor of inverse hyperbolic cosine function.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
Tensor, has the same shape as `input`. The dtype of output is float32 when dtype of `input` is in [bool, int8, uint8, int16, int32, int64]. Otherwise output has the same dtype as `input`.
|
|
70
|
+
|
|
71
|
+
Raises:
|
|
72
|
+
TypeError: If `input` is not a Tensor.
|
|
73
|
+
|
|
74
|
+
Supported Platforms:
|
|
75
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
76
|
+
|
|
77
|
+
Examples:
|
|
78
|
+
>>> import mindspore
|
|
79
|
+
>>> import numpy as np
|
|
80
|
+
>>> from mindspore import Tensor, ops
|
|
81
|
+
>>> input = Tensor(np.array([1.0, 1.5, 3.0, 100.0]), mindspore.float32)
|
|
82
|
+
>>> output = ops.acosh_ext(input)
|
|
83
|
+
>>> print(output)
|
|
84
|
+
[0. 0.9624236 1.7627472 5.298292 ]
|
|
85
|
+
"""
|
|
86
|
+
return acosh_impl(input)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def adaptive_avg_pool2d_grad(grad_output, x):
|
|
90
|
+
r"""
|
|
91
|
+
None
|
|
92
|
+
"""
|
|
93
|
+
return adaptive_avg_pool2d_grad_impl(grad_output, x)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def add(input, other, alpha=1):
|
|
97
|
+
r"""
|
|
98
|
+
Adds scaled other value to input Tensor.
|
|
99
|
+
|
|
100
|
+
.. math::
|
|
101
|
+
|
|
102
|
+
out_{i} = input_{i} + alpha \times other_{i}
|
|
103
|
+
|
|
104
|
+
Note:
|
|
105
|
+
- When the two inputs have different shapes,
|
|
106
|
+
they must be able to broadcast to a common shape.
|
|
107
|
+
- The two inputs and alpha comply with the implicit type conversion rules to make the data types
|
|
108
|
+
consistent.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
input (Union[Tensor, number.Number, bool]): The first input is a number.Number or
|
|
112
|
+
a bool or a tensor whose data type is
|
|
113
|
+
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
114
|
+
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
115
|
+
other (Union[Tensor, number.Number, bool]): The second input, is a number.Number or
|
|
116
|
+
a bool or a tensor whose data type is
|
|
117
|
+
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
118
|
+
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
119
|
+
alpha (number.Number): A scaling factor applied to `other`, default 1.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
Tensor with a shape that is the same as the broadcasted shape of the input `input` and `other`,
|
|
123
|
+
and the data type is the one with higher precision or higher digits among the two inputs and alpha.
|
|
124
|
+
|
|
125
|
+
Raises:
|
|
126
|
+
TypeError: If the type of `input`, `other`, or `alpha` is not one of the following: Tensor, number.Number, bool.
|
|
127
|
+
TypeError: If `alpha` is of type float but `input` and `other` are not of type float.
|
|
128
|
+
TypeError: If `alpha` is of type bool but `input` and `other` are not of type bool.
|
|
129
|
+
|
|
130
|
+
Supported Platforms:
|
|
131
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
132
|
+
|
|
133
|
+
Examples:
|
|
134
|
+
>>> import numpy as np
|
|
135
|
+
>>> import mindspore
|
|
136
|
+
>>> from mindspore import Tensor
|
|
137
|
+
>>> from mindspore import ops
|
|
138
|
+
>>> x = Tensor(1, mindspore.int32)
|
|
139
|
+
>>> y = Tensor(np.array([4, 5, 6]).astype(np.float32))
|
|
140
|
+
>>> alpha = 0.5
|
|
141
|
+
>>> output = ops.auto_generate.add_ext(x, y, alpha)
|
|
142
|
+
>>> print(output)
|
|
143
|
+
[3. 3.5 4.]
|
|
144
|
+
>>> # the data type of x is int32, the data type of y is float32,
|
|
145
|
+
>>> # alpha is a float, and the output is the data format of higher precision float32.
|
|
146
|
+
>>> print(output.dtype)
|
|
147
|
+
Float32
|
|
148
|
+
"""
|
|
149
|
+
return add_impl(input, other, alpha)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def argmax(input, dim=None, keepdim=False):
|
|
153
|
+
r"""
|
|
154
|
+
Return the indices of the maximum values of a tensor across a dimension.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
input (Tensor): Input tensor.
|
|
158
|
+
dim (Union[int, None], optional): The dimension to reduce. If `dim` is ``None`` , the indices of the maximum
|
|
159
|
+
value within the flattened input will be returned. Default: ``None`` .
|
|
160
|
+
keepdim (bool, optional): Whether the output tensor retains the specified
|
|
161
|
+
dimension. Ignored if `dim` is None. Default: ``False`` .
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
Tensor, indices of the maximum values across a dimension.
|
|
165
|
+
|
|
166
|
+
Raises:
|
|
167
|
+
TypeError: If `keepdim` is not bool.
|
|
168
|
+
ValueError: If `dim` is out of range.
|
|
169
|
+
|
|
170
|
+
Supported Platforms:
|
|
171
|
+
``Ascend``
|
|
172
|
+
|
|
173
|
+
Examples:
|
|
174
|
+
>>> import numpy as np
|
|
175
|
+
>>> from mindspore import Tensor
|
|
176
|
+
>>> from mindspore import ops
|
|
177
|
+
>>> x = Tensor(np.array([[1, 20, 5], [67, 8, 9], [130, 24, 15]]).astype(np.float32))
|
|
178
|
+
>>> output = ops.auto_generate.argmax_ext(x, dim=-1)
|
|
179
|
+
>>> print(output)
|
|
180
|
+
[1 0 0]
|
|
181
|
+
"""
|
|
182
|
+
return argmax_impl(input, dim, keepdim)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def argmin(input, dim=None, keepdim=False):
|
|
186
|
+
r"""
|
|
187
|
+
Return the indices of the minimum values of a tensor across a dimension.
|
|
188
|
+
|
|
189
|
+
Args:
|
|
190
|
+
input (Tensor): Input tensor.
|
|
191
|
+
dim (Union[int, None], optional): Specify the axis for calculation. If `dim` is ``None`` , the indices of the minimum
|
|
192
|
+
value within the flattened input will be returned. Default: ``None`` .
|
|
193
|
+
keepdim (bool, optional): Whether the output tensor retains the specified
|
|
194
|
+
dimension. Ignored if `dim` is None. Default: ``False`` .
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
Tensor, indices of the minimum values of the input tensor across a dimension.
|
|
198
|
+
|
|
199
|
+
Raises:
|
|
200
|
+
TypeError: If `keepdim` is not bool.
|
|
201
|
+
ValueError: If `dim` is out of range.
|
|
202
|
+
|
|
203
|
+
Supported Platforms:
|
|
204
|
+
``Ascend``
|
|
205
|
+
|
|
206
|
+
Examples:
|
|
207
|
+
>>> import numpy as np
|
|
208
|
+
>>> from mindspore import Tensor
|
|
209
|
+
>>> from mindspore import mint
|
|
210
|
+
>>> x = Tensor(np.array([[1, 20, 5], [67, 8, 9], [130, 24, 15]]).astype(np.float32))
|
|
211
|
+
>>> output = mint.argmin(x, dim=-1)
|
|
212
|
+
>>> print(output)
|
|
213
|
+
[0 1 2]
|
|
214
|
+
"""
|
|
215
|
+
return argmin_impl(input, dim, keepdim)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def asin(input):
|
|
219
|
+
r"""
|
|
220
|
+
Computes arcsine of input tensors element-wise.
|
|
221
|
+
|
|
222
|
+
.. math::
|
|
223
|
+
|
|
224
|
+
out_i = \sin^{-1}(input_i)
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
input (Tensor): The shape of tensor is
|
|
228
|
+
:math:`(N,*)`, where :math:`*` means any number of additional dimensions.
|
|
229
|
+
|
|
230
|
+
Returns:
|
|
231
|
+
Tensor, has the same shape as `input`. The dtype of output is float32 when dtype of `input` is in [bool, int8, uint8, int16, int32, int64]. Otherwise output has the same dtype as `input`.
|
|
232
|
+
|
|
233
|
+
Raises:
|
|
234
|
+
TypeError: If `input` is not a Tensor.
|
|
235
|
+
|
|
236
|
+
Supported Platforms:
|
|
237
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
238
|
+
|
|
239
|
+
Examples:
|
|
240
|
+
>>> import mindspore
|
|
241
|
+
>>> import numpy as np
|
|
242
|
+
>>> from mindspore import Tensor, ops
|
|
243
|
+
>>> input = Tensor(np.array([0.74, 0.04, 0.30, 0.56]), mindspore.float32)
|
|
244
|
+
>>> output = ops.asin_ext(input)
|
|
245
|
+
>>> print(output)
|
|
246
|
+
[0.8330927 0.04001068 0.30469266 0.59438497 ]
|
|
247
|
+
"""
|
|
248
|
+
return asin_impl(input)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def asinh(input):
|
|
252
|
+
r"""
|
|
253
|
+
Computes inverse hyperbolic sine of the input element-wise.
|
|
254
|
+
|
|
255
|
+
.. math::
|
|
256
|
+
|
|
257
|
+
out_i = \sinh^{-1}(input_i)
|
|
258
|
+
|
|
259
|
+
Args:
|
|
260
|
+
input (Tensor): The input tensor of inverse hyperbolic sine function.
|
|
261
|
+
|
|
262
|
+
Returns:
|
|
263
|
+
Tensor, has the same shape as `input`. The dtype of output is float32 when dtype of `input` is in [bool, int8, uint8, int16, int32, int64]. Otherwise output has the same dtype as `input`.
|
|
264
|
+
|
|
265
|
+
Raises:
|
|
266
|
+
TypeError: If `input` is not a Tensor.
|
|
267
|
+
|
|
268
|
+
Supported Platforms:
|
|
269
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
270
|
+
|
|
271
|
+
Examples:
|
|
272
|
+
>>> import mindspore
|
|
273
|
+
>>> import numpy as np
|
|
274
|
+
>>> from mindspore import Tensor, ops
|
|
275
|
+
>>> input = Tensor(np.array([-5.0, 1.5, 3.0, 100.0]), mindspore.float32)
|
|
276
|
+
>>> output = ops.asinh_ext(input)
|
|
277
|
+
>>> print(output)
|
|
278
|
+
[-2.3124385 1.1947632 1.8184465 5.298342 ]
|
|
279
|
+
"""
|
|
280
|
+
return asinh_impl(input)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def atan2(input, other):
|
|
284
|
+
r"""
|
|
285
|
+
Returns arctangent of input/other element-wise.
|
|
286
|
+
|
|
287
|
+
It returns :math:`\theta\ \in\ [-\pi, \pi]`
|
|
288
|
+
such that :math:`input = r*\sin(\theta), other = r*\cos(\theta)`, where :math:`r = \sqrt{input^2 + other^2}`.
|
|
289
|
+
|
|
290
|
+
Note:
|
|
291
|
+
- Arg `input` and `other` comply with the implicit type conversion rules to make the data types consistent.
|
|
292
|
+
If they have different data types, the lower precision data type will be converted to relatively the
|
|
293
|
+
highest precision data type.
|
|
294
|
+
|
|
295
|
+
Args:
|
|
296
|
+
input (Tensor, Number.number): The input tensor or scalar.
|
|
297
|
+
other (Tensor, Number.number): The input tensor or scalar. It has the same shape with `input` or
|
|
298
|
+
its shape is able to broadcast with `input`.
|
|
299
|
+
|
|
300
|
+
Returns:
|
|
301
|
+
Tensor, the shape is the same as the one after broadcasting.
|
|
302
|
+
The dtype of output is float32 when dtype of `input` is in
|
|
303
|
+
[bool, int8, uint8, int16, int32, int64]. Otherwise output has the same dtype as `input`.
|
|
304
|
+
|
|
305
|
+
Raises:
|
|
306
|
+
TypeError: If `input` or `other` is not a Tensor or scalar.
|
|
307
|
+
RuntimeError: If the data type of `input` and `other` conversion of Parameter is required
|
|
308
|
+
when data type conversion of Parameter is not supported.
|
|
309
|
+
|
|
310
|
+
Supported Platforms:
|
|
311
|
+
``Ascend``
|
|
312
|
+
|
|
313
|
+
Examples:
|
|
314
|
+
>>> import mindspore
|
|
315
|
+
>>> import numpy as np
|
|
316
|
+
>>> from mindspore import Tensor, ops
|
|
317
|
+
>>> input = Tensor(np.array([0, 1]), mindspore.float32)
|
|
318
|
+
>>> other = Tensor(np.array([1, 1]), mindspore.float32)
|
|
319
|
+
>>> output = mint.atan2(input, other)
|
|
320
|
+
>>> print(output)
|
|
321
|
+
[0. 0.7853982]
|
|
322
|
+
"""
|
|
323
|
+
return atan2_impl(input, other)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def atan(input):
|
|
327
|
+
r"""
|
|
328
|
+
Computes the trigonometric inverse tangent of the input element-wise.
|
|
329
|
+
|
|
330
|
+
.. math::
|
|
331
|
+
|
|
332
|
+
out_i = \tan^{-1}(input_i)
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
input (Tensor): The shape of tensor is
|
|
336
|
+
:math:`(N,*)` where :math:`*` means, any number of additional dimensions.
|
|
337
|
+
|
|
338
|
+
Returns:
|
|
339
|
+
Tensor, has the same shape as `input`. The dtype of output is float32 when dtype of `input` is in [bool, int8, uint8, int16, int32, int64]. Otherwise output has the same dtype as `input`.
|
|
340
|
+
|
|
341
|
+
Raises:
|
|
342
|
+
TypeError: If `input` is not a Tensor.
|
|
343
|
+
|
|
344
|
+
Supported Platforms:
|
|
345
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
346
|
+
|
|
347
|
+
Examples:
|
|
348
|
+
>>> import mindspore
|
|
349
|
+
>>> import numpy as np
|
|
350
|
+
>>> from mindspore import Tensor, ops
|
|
351
|
+
>>> input = Tensor(np.array([1.0, 0.0]), mindspore.float32)
|
|
352
|
+
>>> output = ops.atan_ext(input)
|
|
353
|
+
>>> print(output)
|
|
354
|
+
[0.7853982 0. ]
|
|
355
|
+
"""
|
|
356
|
+
return atan_impl(input)
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
def bmm(input, mat2):
|
|
360
|
+
r"""
|
|
361
|
+
Performs batch matrix-matrix multiplication of two three-dimensional tensors.
|
|
362
|
+
|
|
363
|
+
.. math::
|
|
364
|
+
\text{output}= \text{input} @ \text{mat2}
|
|
365
|
+
|
|
366
|
+
Args:
|
|
367
|
+
input (Tensor): The first batch of matrices to be multiplied. Must be a three-dimensional tensor of shape `(b, n, m)`.
|
|
368
|
+
mat2 (Tensor): The second batch of matrices to be multiplied. Must be a three-dimensional tensor of shape `(b, m, p)`.
|
|
369
|
+
|
|
370
|
+
Returns:
|
|
371
|
+
Tensor, the output tensor of shape `(b, n, p)`, where each matrix is the product of the corresponding matrices in the input batches.
|
|
372
|
+
|
|
373
|
+
Raises:
|
|
374
|
+
ValueError: If `input` or `mat2` is not three-dimensional tensors.
|
|
375
|
+
ValueError: If the length of the third dimension of `input` is not equal to the length of the second dimension of `mat2`.
|
|
376
|
+
ValueError: If the batch size of the inputs is not equal to the batch size of the mat2.
|
|
377
|
+
|
|
378
|
+
Supported Platforms:
|
|
379
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
380
|
+
|
|
381
|
+
Examples:
|
|
382
|
+
>>> import mindspore
|
|
383
|
+
>>> import numpy as np
|
|
384
|
+
>>> from mindspore import Tensor
|
|
385
|
+
>>> from mindspore import ops
|
|
386
|
+
>>> a = Tensor(np.ones(shape=[2, 3, 4]), mindspore.float32)
|
|
387
|
+
>>> b = Tensor(np.ones(shape=[2, 4, 5]), mindspore.float32)
|
|
388
|
+
>>> output = ops.auto_generate.bmm_ext(a, b)
|
|
389
|
+
>>> print(output)
|
|
390
|
+
[[[4. 4. 4. 4. 4.]
|
|
391
|
+
[4. 4. 4. 4. 4.]
|
|
392
|
+
[4. 4. 4. 4. 4.]]
|
|
393
|
+
[[4. 4. 4. 4. 4.]
|
|
394
|
+
[4. 4. 4. 4. 4.]
|
|
395
|
+
[4. 4. 4. 4. 4.]]]
|
|
396
|
+
"""
|
|
397
|
+
return bmm_impl(input, mat2)
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
def fold(input, output_size, kernel_size, dilation=1, padding=0, stride=1):
|
|
401
|
+
r"""
|
|
402
|
+
Combines an array of sliding local blocks into a large containing tensor.
|
|
403
|
+
|
|
404
|
+
Consider a batched input tensor of shape :math:`(N, C \times \prod(\text{kernel_size}), L)` ,
|
|
405
|
+
where :math:`N` is the batch dimension, :math:`C \times \prod(\text{kernel_size})` is the
|
|
406
|
+
total number of values within each block (a block has :math:`\prod(\text{kernel_size})` spatial
|
|
407
|
+
locations each containing a `C`-channeled vector), and :math:`L` is the total number of such blocks:
|
|
408
|
+
|
|
409
|
+
.. math::
|
|
410
|
+
L = \prod_d \left\lfloor\frac{\text{output_size}[d] + 2 \times \text{padding}[d] %
|
|
411
|
+
- \text{dilation}[d] \times (\text{kernel_size}[d] - 1) - 1}{\text{stride}[d]} + 1\right\rfloor,
|
|
412
|
+
|
|
413
|
+
where :math:`d` is over all spatial dimensions.
|
|
414
|
+
|
|
415
|
+
Therefore, `output_size` is the spatial shape of the large containing tensor of the sliding local blocks.
|
|
416
|
+
|
|
417
|
+
The `dilation`, `padding` and `stride` arguments specify how the sliding blocks are retrieved.
|
|
418
|
+
|
|
419
|
+
.. warning::
|
|
420
|
+
Currently, only unbatched(3D) or batched(4D) image-like output tensors are supported.
|
|
421
|
+
|
|
422
|
+
Args:
|
|
423
|
+
input (Tensor): 2-D or 3-D Tensor.
|
|
424
|
+
output_size (Union[int, tuple[int], list[int]]): The shape of the spatial dimensions of
|
|
425
|
+
the output(i.e., output.shape[2:]).
|
|
426
|
+
kernel_size (Union[int, tuple[int], list[int]]): The size of the kernel, should be two int
|
|
427
|
+
for height and width. If type is int, it means that height equal with width. Must be specified.
|
|
428
|
+
dilation (Union[int, tuple[int], list[int]], optional): The size of the dilation, should be two int
|
|
429
|
+
for height and width. If type is int, it means that height equal with width. Default: ``1`` .
|
|
430
|
+
padding (Union[int, tuple[int], list[int]], optional): The size of the padding, should be two int
|
|
431
|
+
for height and width. If type is int, it means that height equal with width. Default: ``0`` .
|
|
432
|
+
stride (Union[int, tuple[int], list[int]], optional): The size of the stride, should be two int
|
|
433
|
+
for height and width. If type is int, it means that height equal with width. Default: ``1`` .
|
|
434
|
+
|
|
435
|
+
Returns:
|
|
436
|
+
A Tensor, with same type as `input` .
|
|
437
|
+
|
|
438
|
+
Shape:
|
|
439
|
+
- Input: :math:`(N, C \times \prod(\text{kernel_size}), L)` or
|
|
440
|
+
:math:`(C \times \prod(\text{kernel_size}), L)`
|
|
441
|
+
- Output: :math:`(N, C, output\_size[0], output\_size[1], ...)` or
|
|
442
|
+
:math:`(C, output\_size[0], output\_size[1], ...)`
|
|
443
|
+
|
|
444
|
+
Raises:
|
|
445
|
+
TypeError: If `output_size`, `kernel_size`, `stride`, `dilation`, `padding` data type is not int, tuple or list.
|
|
446
|
+
ValueError: If `output_size`, `kernel_size`, `dilation`, `stride` value is not
|
|
447
|
+
greater than zero or elements number invalid.
|
|
448
|
+
ValueError: If `padding` value is less than zero or elements number invalid.
|
|
449
|
+
ValueError: If input.shape[-2] can't be divisible by the product of kernel_size.
|
|
450
|
+
ValueError: If `input.shape[-1]` is not equal to the calculated number of sliding blocks `L`.
|
|
451
|
+
|
|
452
|
+
Supported Platforms:
|
|
453
|
+
``Ascend``
|
|
454
|
+
|
|
455
|
+
Examples:
|
|
456
|
+
>>> import numpy as np
|
|
457
|
+
>>> from mindspore import Tensor, ops
|
|
458
|
+
>>> x = Tensor(np.random.rand(16, 64, 25).astype(np.float32))
|
|
459
|
+
>>> output = ops.auto_generate.fold_ext(x, (8, 8), [2, 2], [2, 2], [2, 2], [2, 2])
|
|
460
|
+
>>> print(output.shape)
|
|
461
|
+
(16, 16, 8, 8)
|
|
462
|
+
"""
|
|
463
|
+
return fold_impl(input, converted_output_size, converted_kernel_size, converted_dilation, converted_padding, converted_stride)
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
def copy(variable, value):
|
|
467
|
+
r"""
|
|
468
|
+
None
|
|
469
|
+
"""
|
|
470
|
+
return copy_impl(variable, value)
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
def cummin(input, dim):
|
|
474
|
+
r"""
|
|
475
|
+
Returns a tuple (values, indices) where `values` is the cumulative minimum value of input Tensor `input`
|
|
476
|
+
along the dimension `dim`, and `indices` is the index location of each minimum value.
|
|
477
|
+
|
|
478
|
+
.. math::
|
|
479
|
+
\begin{array}{ll} \\
|
|
480
|
+
y_{i} = \min(x_{1}, x_{2}, ... , x_{i})
|
|
481
|
+
\end{array}
|
|
482
|
+
|
|
483
|
+
Args:
|
|
484
|
+
input (Tensor): The input Tensor, The dimension must be greater than 0.
|
|
485
|
+
dim (int): Operation dimension. The value of `dim` must be in the range `[-input.ndim, input.ndim - 1]`.
|
|
486
|
+
|
|
487
|
+
Returns:
|
|
488
|
+
tuple [Tensor], tuple of 2 Tensors, containing the cumulative minimum of elements and the index.
|
|
489
|
+
The shape of each output tensor is the same as that of input `input`.
|
|
490
|
+
|
|
491
|
+
Raises:
|
|
492
|
+
TypeError: If `input` is not a Tensor.
|
|
493
|
+
TypeError: If `input` is a Tensor, but the type is complex or bool.
|
|
494
|
+
TypeError: If `dim` is not an int.
|
|
495
|
+
ValueError: If `dim` is out the range of `[-input.ndim, input.ndim - 1]`.
|
|
496
|
+
|
|
497
|
+
.. note::
|
|
498
|
+
O2 mode is not supported in Ascend.
|
|
499
|
+
|
|
500
|
+
Supported Platforms:
|
|
501
|
+
``Ascend``
|
|
502
|
+
|
|
503
|
+
Examples:
|
|
504
|
+
>>> from mindspore import Tensor, ops
|
|
505
|
+
>>> import mindspore
|
|
506
|
+
>>> a = Tensor([-0.2284, -0.6628, 0.0975, 0.2680, -1.3298, -0.4220], mindspore.float32)
|
|
507
|
+
>>> output = ops.cummin_ext(a, dim=0)
|
|
508
|
+
>>> print(output[0])
|
|
509
|
+
[-0.2284 -0.6628 -0.6628 -0.6628 -1.3298 -1.3298]
|
|
510
|
+
>>> print(output[1])
|
|
511
|
+
[0 1 1 1 4 4]
|
|
512
|
+
"""
|
|
513
|
+
return cummin_impl(input, dim)
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
def cumsum(input, dim, dtype=None):
|
|
517
|
+
r"""
|
|
518
|
+
Computes the cumulative sum of input Tensor along `dim`.
|
|
519
|
+
|
|
520
|
+
.. math::
|
|
521
|
+
|
|
522
|
+
y_i = x_1 + x_2 + x_3 + ... + x_i
|
|
523
|
+
|
|
524
|
+
Args:
|
|
525
|
+
input (Tensor): The input Tensor.
|
|
526
|
+
dim (int): Dim along which the cumulative sum is computed.
|
|
527
|
+
dtype (:class:`mindspore.dtype`, optional): The desired dtype of returned Tensor. If specified,
|
|
528
|
+
the input Tensor will be cast to `dtype` before the computation. This is useful for preventing overflows.
|
|
529
|
+
If not specified, stay the same as original Tensor. Default: ``None`` .
|
|
530
|
+
|
|
531
|
+
Returns:
|
|
532
|
+
Tensor, the shape of the output Tensor is consistent with the input Tensor's.
|
|
533
|
+
|
|
534
|
+
Raises:
|
|
535
|
+
TypeError: If `input` is not a Tensor.
|
|
536
|
+
ValueError: If the `dim` is out of range.
|
|
537
|
+
|
|
538
|
+
Supported Platforms:
|
|
539
|
+
``Ascend``
|
|
540
|
+
|
|
541
|
+
Examples:
|
|
542
|
+
>>> import numpy as np
|
|
543
|
+
>>> from mindspore import Tensor
|
|
544
|
+
>>> import mindspore.ops as ops
|
|
545
|
+
>>> x = Tensor(np.array([[3, 4, 6, 10], [1, 6, 7, 9], [4, 3, 8, 7], [1, 3, 7, 9]]).astype(np.float32))
|
|
546
|
+
>>> # case 1: along the dim 0
|
|
547
|
+
>>> y = ops.auto_generate.cumsum_ext(x, 0)
|
|
548
|
+
>>> print(y)
|
|
549
|
+
[[ 3. 4. 6. 10.]
|
|
550
|
+
[ 4. 10. 13. 19.]
|
|
551
|
+
[ 8. 13. 21. 26.]
|
|
552
|
+
[ 9. 16. 28. 35.]]
|
|
553
|
+
>>> # case 2: along the dim 1
|
|
554
|
+
>>> y = ops.auto_generate.cumsum_ext(x, 1)
|
|
555
|
+
>>> print(y)
|
|
556
|
+
[[ 3. 7. 13. 23.]
|
|
557
|
+
[ 1. 7. 14. 23.]
|
|
558
|
+
[ 4. 7. 15. 22.]
|
|
559
|
+
[ 1. 4. 11. 20.]]
|
|
560
|
+
"""
|
|
561
|
+
return cumsum_impl(input, dim, dtype)
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
def elu(input, alpha=1.0):
|
|
565
|
+
r"""
|
|
566
|
+
Exponential Linear Unit activation function.
|
|
567
|
+
|
|
568
|
+
Applies the exponential linear unit function element-wise.
|
|
569
|
+
The activation function is defined as:
|
|
570
|
+
|
|
571
|
+
.. math::
|
|
572
|
+
|
|
573
|
+
\text{ELU}(x)= \left\{
|
|
574
|
+
\begin{array}{align}
|
|
575
|
+
\alpha(e^{x} - 1) & \text{if } x \le 0\\
|
|
576
|
+
x & \text{if } x \gt 0\\
|
|
577
|
+
\end{array}\right.
|
|
578
|
+
|
|
579
|
+
Where :math:`x` is the element of input Tensor `input`, :math:`\alpha` is param `alpha`,
|
|
580
|
+
it determines the smoothness of ELU.
|
|
581
|
+
|
|
582
|
+
ELU function graph:
|
|
583
|
+
|
|
584
|
+
.. image:: ../images/ELU.png
|
|
585
|
+
:align: center
|
|
586
|
+
|
|
587
|
+
Args:
|
|
588
|
+
input (Tensor): The input of ELU is a Tensor of any dimension.
|
|
589
|
+
alpha (float, optional): The alpha value of ELU, the data type is float.
|
|
590
|
+
Default: ``1.0`` .
|
|
591
|
+
|
|
592
|
+
Returns:
|
|
593
|
+
Tensor, has the same shape and data type as `input`.
|
|
594
|
+
|
|
595
|
+
Raises:
|
|
596
|
+
TypeError: If `alpha` is not a float.
|
|
597
|
+
|
|
598
|
+
Supported Platforms:
|
|
599
|
+
``Ascend``
|
|
600
|
+
|
|
601
|
+
Examples:
|
|
602
|
+
>>> import mindspore
|
|
603
|
+
>>> import numpy as np
|
|
604
|
+
>>> from mindspore import Tensor, ops
|
|
605
|
+
>>> x = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32)
|
|
606
|
+
>>> output = ops.auto_generate.elu_ext(x)
|
|
607
|
+
>>> print(output)
|
|
608
|
+
[[-0.63212055 4. -0.99966455]
|
|
609
|
+
[ 2. -0.99326205 9. ]]
|
|
610
|
+
"""
|
|
611
|
+
return elu_impl(input, alpha)
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
def ffn(x, weight1, weight2, expertTokens=None, bias1=None, bias2=None, scale=None, offset=None, deqScale1=None, deqScale2=None, antiquant_scale1=None, antiquant_scale2=None, antiquant_offset1=None, antiquant_offset2=None, activation='fastgelu', inner_precise=0):
|
|
615
|
+
r"""
|
|
616
|
+
None
|
|
617
|
+
"""
|
|
618
|
+
return ffn_impl(x, weight1, weight2, expertTokens, bias1, bias2, scale, offset, deqScale1, deqScale2, antiquant_scale1, antiquant_scale2, antiquant_offset1, antiquant_offset2, converted_activation, inner_precise)
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
def flatten(input, start_dim=0, end_dim=-1):
|
|
622
|
+
r"""
|
|
623
|
+
Flatten a tensor along dimensions from `start_dim` to `end_dim`.
|
|
624
|
+
|
|
625
|
+
Args:
|
|
626
|
+
input (Tensor): The input Tensor.
|
|
627
|
+
start_dim (int, optional): The first dimension to flatten. Default: ``0`` .
|
|
628
|
+
end_dim (int, optional): The last dimension to flatten. Default: ``-1`` .
|
|
629
|
+
|
|
630
|
+
Returns:
|
|
631
|
+
Tensor. If no dimensions are flattened, returns the original `input`, otherwise return the flattened Tensor.
|
|
632
|
+
If `input` is a 0-dimensional Tensor, a 1-dimensional Tensor will be returned.
|
|
633
|
+
|
|
634
|
+
Raises:
|
|
635
|
+
TypeError: If `input` is not a Tensor.
|
|
636
|
+
TypeError: If `start_dim` or `end_dim` is not int.
|
|
637
|
+
ValueError: If `start_dim` is greater than `end_dim` after canonicalized.
|
|
638
|
+
ValueError: If `start_dim` or `end_dim` is not in range of [-input.dim, input.dim-1].
|
|
639
|
+
|
|
640
|
+
Supported Platforms:
|
|
641
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
642
|
+
|
|
643
|
+
Examples:
|
|
644
|
+
>>> import mindspore
|
|
645
|
+
>>> import numpy as np
|
|
646
|
+
>>> from mindspore import Tensor, ops
|
|
647
|
+
>>> input_x = Tensor(np.ones(shape=[1, 2, 3, 4]), mindspore.float32)
|
|
648
|
+
>>> output = ops.auto_generate.flatten_ext(input_x)
|
|
649
|
+
>>> print(output.shape)
|
|
650
|
+
(24,)
|
|
651
|
+
"""
|
|
652
|
+
return flatten_impl(input, start_dim, end_dim)
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
def histc(input, bins=100, min=0, max=0):
|
|
656
|
+
r"""
|
|
657
|
+
Computes the histogram of a tensor.
|
|
658
|
+
|
|
659
|
+
The elements are sorted into equal width bins between `min` and `max`.
|
|
660
|
+
If `min` and `max` are both zero, the minimum and maximum values of the data are used.
|
|
661
|
+
|
|
662
|
+
Elements lower than min or higher than max are ignored.
|
|
663
|
+
|
|
664
|
+
.. warning::
|
|
665
|
+
This is an experimental API that is subject to change or deletion.
|
|
666
|
+
If input is int64, valid values fit within int32; exceeding this may cause precision errors.
|
|
667
|
+
|
|
668
|
+
Args:
|
|
669
|
+
input (Tensor): the input tensor.
|
|
670
|
+
bins (int, optional): Number of histogram bins, optional. If specified, must be positive. Default: ``100`` .
|
|
671
|
+
min (int, float, optional): the lower end of the range (inclusive), optional. Default: ``0`` .
|
|
672
|
+
max (int, float, optional): the upper end of the range (inclusive), optional. Default: ``0`` .
|
|
673
|
+
|
|
674
|
+
Returns:
|
|
675
|
+
A 1-D Tensor, has the same type as `input` with the shape :math:`(bins, )`.
|
|
676
|
+
|
|
677
|
+
Raises:
|
|
678
|
+
TypeError: If `input` is not a Tensor.
|
|
679
|
+
TypeError: If `input` datatype is not in support list.
|
|
680
|
+
TypeError: If attr `min` or `max` is not float or int.
|
|
681
|
+
TypeError: If attr `bins` is not int.
|
|
682
|
+
ValueError: If attr value `min` > `max`.
|
|
683
|
+
ValueError: If attr `bins` <= 0.
|
|
684
|
+
|
|
685
|
+
Supported Platforms:
|
|
686
|
+
``Ascend``
|
|
687
|
+
|
|
688
|
+
Examples:
|
|
689
|
+
>>> from mindspore import Tensor, ops
|
|
690
|
+
>>> x = Tensor([1., 2, 1])
|
|
691
|
+
>>> y = ops.histc_ext(x, bins=4, min=0, max=3)
|
|
692
|
+
>>> print(y)
|
|
693
|
+
[0 2 1 0]
|
|
694
|
+
"""
|
|
695
|
+
return histc_impl(input, bins, min, max)
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
def unfold(input, kernel_size, dilation=1, padding=0, stride=1):
|
|
699
|
+
r"""
|
|
700
|
+
Extracts sliding local blocks from a batched input tensor.
|
|
701
|
+
|
|
702
|
+
Consider a batched input tensor of shape :math:`(N, C, *)`,
|
|
703
|
+
where :math:`N` is the batch dimension, :math:`C` is the channel dimension,
|
|
704
|
+
and :math:`*` represent arbitrary spatial dimensions. This operation flattens
|
|
705
|
+
each sliding `Kernel_size`- sized block within the spatial dimensions
|
|
706
|
+
of `input` into a column (i.e., last dimension) of a 3-D output
|
|
707
|
+
tensor of shape :math:`(N, C \times \prod(\text{kernel_size}), L)`, where
|
|
708
|
+
:math:`C \times \prod(\text{kernel_size})` is the total number of values
|
|
709
|
+
within each block (a block has :math:`\prod(\text{kernel_size})` spatial
|
|
710
|
+
locations each containing a `C`-channeled vector), and :math:`L` is
|
|
711
|
+
the total number of such blocks:
|
|
712
|
+
|
|
713
|
+
.. math::
|
|
714
|
+
L = \prod_d \left\lfloor\frac{\text{spatial_size}[d] + 2 \times \text{padding}[d] %
|
|
715
|
+
- \text{dilation}[d] \times (\text{kernel_size}[d] - 1) - 1}{\text{stride}[d]} + 1\right\rfloor,
|
|
716
|
+
|
|
717
|
+
where :math:`\text{spatial_size}` is formed by the spatial dimensions
|
|
718
|
+
of `input` (:math:`*` above), and :math:`d` is over all spatial
|
|
719
|
+
dimensions.
|
|
720
|
+
|
|
721
|
+
Therefore, indexing `output` at the last dimension (column dimension)
|
|
722
|
+
gives all values within a certain block.
|
|
723
|
+
|
|
724
|
+
The `dilation`, `padding` and `stride` arguments specify
|
|
725
|
+
how the sliding blocks are retrieved.
|
|
726
|
+
|
|
727
|
+
.. warning::
|
|
728
|
+
- Currently, batched(4D) image-like tensors are supported.
|
|
729
|
+
- For Ascend, it is only supported on platforms above Atlas A2.
|
|
730
|
+
|
|
731
|
+
Args:
|
|
732
|
+
input (Tensor): 4-D Tensor.
|
|
733
|
+
kernel_size (Union[int, tuple[int], list[int]]): The size of the kernel, should be two int
|
|
734
|
+
for height and width. If type is int, it means that height equal with width. Must be specified.
|
|
735
|
+
dilation (Union[int, tuple[int], list[int]], optional): The dilation of the window, should be two int
|
|
736
|
+
for height and width. If type is int, it means that height equal with width. Default: ``1`` .
|
|
737
|
+
padding (Union[int, tuple[int], list[int]], optional): The pad of the window, should be two int
|
|
738
|
+
for height and width. If type is int, it means that height equal with width. Default: ``0`` .
|
|
739
|
+
stride (Union[int, tuple[int], list[int]], optional): The stride of the window, should be two int
|
|
740
|
+
for height and width. If type is int, it means that height equal with width. Default: ``1`` .
|
|
741
|
+
|
|
742
|
+
Returns:
|
|
743
|
+
A Tensor, with same type as `input` .
|
|
744
|
+
|
|
745
|
+
Shape:
|
|
746
|
+
- Input: :math:`(N, C, *)`
|
|
747
|
+
- Output: :math:`(N, C \times \prod(\text{kernel_size}), L)`
|
|
748
|
+
|
|
749
|
+
Raises:
|
|
750
|
+
TypeError: If any data type of `kernel_size`, `stride`, `dilation`, `padding` is not int, tuple or list.
|
|
751
|
+
ValueError: If `kernel_size`, `dilation`, `stride` value is not
|
|
752
|
+
greater than zero or elements number more than `2`.
|
|
753
|
+
ValueError: If `padding` value is less than zero.
|
|
754
|
+
|
|
755
|
+
Supported Platforms:
|
|
756
|
+
``Ascend``
|
|
757
|
+
|
|
758
|
+
Examples:
|
|
759
|
+
>>> import mindspore
|
|
760
|
+
>>> import numpy as np
|
|
761
|
+
>>> from mindspore import Tensor, ops
|
|
762
|
+
>>> x = Tensor(np.random.rand(4, 4, 32, 32), mindspore.float32)
|
|
763
|
+
>>> output = ops.auto_generate.unfold_ext(x, kernel_size=3, dilation=1, stride=1)
|
|
764
|
+
>>> print(output.shape)
|
|
765
|
+
(4, 36, 900)
|
|
766
|
+
"""
|
|
767
|
+
return unfold_impl(input, converted_kernel_size, converted_dilation, converted_padding, converted_stride)
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
def index_select(input, dim, index):
|
|
771
|
+
r"""
|
|
772
|
+
Generates a new Tensor that accesses the values of `input` along the specified `dim` dimension
|
|
773
|
+
using the indices specified in `index`. The new Tensor has the same number of dimensions as `input`,
|
|
774
|
+
with the size of the `dim` dimension being equal to the length of `index`, and the size of all other
|
|
775
|
+
dimensions will be unchanged from the original `input` Tensor.
|
|
776
|
+
|
|
777
|
+
.. note::
|
|
778
|
+
The value of index must be in the range of `[0, input.shape[dim])`, the result is undefined out of range.
|
|
779
|
+
|
|
780
|
+
Args:
|
|
781
|
+
input (Tensor): The input Tensor.
|
|
782
|
+
dim (int): The dimension to be indexed.
|
|
783
|
+
index (Tensor): A 1-D Tensor with the indices.
|
|
784
|
+
|
|
785
|
+
Returns:
|
|
786
|
+
Tensor, has the same dtype as input Tensor.
|
|
787
|
+
|
|
788
|
+
Raises:
|
|
789
|
+
TypeError: If `input` or `index` is not a Tensor.
|
|
790
|
+
TypeError: If `dim` is not int number.
|
|
791
|
+
ValueError: If the value of `dim` is out the range of `[-input.ndim, input.ndim - 1]`.
|
|
792
|
+
ValueError: If the dimension of `index` is not equal to 1.
|
|
793
|
+
|
|
794
|
+
Supported Platforms:
|
|
795
|
+
``Ascend``
|
|
796
|
+
|
|
797
|
+
Examples:
|
|
798
|
+
>>> import mindspore
|
|
799
|
+
>>> from mindspore import Tensor, ops
|
|
800
|
+
>>> import numpy as np
|
|
801
|
+
>>> input = Tensor(np.arange(16).astype(np.float32).reshape(2, 2, 4))
|
|
802
|
+
>>> print(input)
|
|
803
|
+
[[[ 0. 1. 2. 3.]
|
|
804
|
+
[ 4. 5. 6. 7.]]
|
|
805
|
+
[[ 8. 9. 10. 11.]
|
|
806
|
+
[12. 13. 14. 15.]]]
|
|
807
|
+
>>> index = Tensor([0,], mindspore.int32)
|
|
808
|
+
>>> y = ops.auto_generate.index_select_ext(input, 1, index)
|
|
809
|
+
>>> print(y)
|
|
810
|
+
[[[ 0. 1. 2. 3.]]
|
|
811
|
+
[[ 8. 9. 10. 11.]]]
|
|
812
|
+
"""
|
|
813
|
+
return index_select_impl(input, dim, index)
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
def inplace_add(input, other, alpha=1):
|
|
817
|
+
r"""
|
|
818
|
+
None
|
|
819
|
+
"""
|
|
820
|
+
return inplace_add_impl(input, other, alpha)
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
def inplace_adds(input, other, alpha=1):
|
|
824
|
+
r"""
|
|
825
|
+
None
|
|
826
|
+
"""
|
|
827
|
+
return inplace_adds_impl(input, other, alpha)
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
def l1_loss(input, target, reduction='mean'):
|
|
831
|
+
r"""
|
|
832
|
+
Calculate the mean absolute error between the `input` value and the `target` value.
|
|
833
|
+
|
|
834
|
+
Assuming that the :math:`x` and :math:`y` are the predicted value and target value,
|
|
835
|
+
both are one-dimensional tensors of length :math:`N`, length :math:`N`, `reduction` is set to ``'none'`` ,
|
|
836
|
+
then calculate the loss of :math:`x` and :math:`y` without dimensionality reduction.
|
|
837
|
+
|
|
838
|
+
The formula is as follows:
|
|
839
|
+
|
|
840
|
+
.. math::
|
|
841
|
+
\ell(x, y) = L = \{l_1,\dots,l_N\}^\top, \quad \text{with } l_n = \left| x_n - y_n \right|,
|
|
842
|
+
|
|
843
|
+
where :math:`N` is the batch size.
|
|
844
|
+
|
|
845
|
+
If `reduction` is ``'mean'`` or ``'sum'`` , then:
|
|
846
|
+
|
|
847
|
+
.. math::
|
|
848
|
+
\ell(x, y) =
|
|
849
|
+
\begin{cases}
|
|
850
|
+
\operatorname{mean}(L), & \text{if reduction} = \text{'mean';}\\
|
|
851
|
+
\operatorname{sum}(L), & \text{if reduction} = \text{'sum'.}
|
|
852
|
+
\end{cases}
|
|
853
|
+
|
|
854
|
+
Args:
|
|
855
|
+
input (Tensor): Predicted value, Tensor of any dimension.
|
|
856
|
+
target (Tensor): Target value, usually has the same shape as the `input`.
|
|
857
|
+
If `input` and `target` have different shapes, make sure they can broadcast to each other.
|
|
858
|
+
reduction (str, optional): Apply specific reduction method to the output: ``'none'`` , ``'mean'`` ,
|
|
859
|
+
``'sum'`` . Default: ``'mean'`` .
|
|
860
|
+
|
|
861
|
+
- ``'none'``: no reduction will be applied.
|
|
862
|
+
- ``'mean'``: compute and return the mean of elements in the output. Notice: At least one of the input and target is float type when the reduction is ``'mean'`` .
|
|
863
|
+
- ``'sum'``: the output elements will be summed.
|
|
864
|
+
|
|
865
|
+
Returns:
|
|
866
|
+
Tensor or Scalar, if `reduction` is ``'none'`` , return a Tensor with same shape and dtype as `input`.
|
|
867
|
+
Otherwise, a scalar value will be returned.
|
|
868
|
+
|
|
869
|
+
Raises:
|
|
870
|
+
TypeError: If `input` is not a Tensor.
|
|
871
|
+
TypeError: If `target` is not a Tensor.
|
|
872
|
+
ValueError: If `reduction` is not one of ``'none'`` , ``'mean'`` or ``'sum'`` .
|
|
873
|
+
|
|
874
|
+
Supported Platforms:
|
|
875
|
+
``Ascend``
|
|
876
|
+
|
|
877
|
+
Examples:
|
|
878
|
+
>>> from mindspore import Tensor, ops
|
|
879
|
+
>>> from mindspore import dtype as mstype
|
|
880
|
+
>>> x = Tensor([[1, 2, 3], [4, 5, 6]], mstype.float32)
|
|
881
|
+
>>> target = Tensor([[6, 5, 4], [3, 2, 1]], mstype.float32)
|
|
882
|
+
>>> output = ops.l1_loss_ext(x, target, reduction="mean")
|
|
883
|
+
>>> print(output)
|
|
884
|
+
3.0
|
|
885
|
+
"""
|
|
886
|
+
return l1_loss_impl(input, target, converted_reduction)
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
def leaky_relu(input, negative_slope=0.01):
|
|
890
|
+
r"""
|
|
891
|
+
leaky_relu activation function. The element of `input` less than 0 times `negative_slope` .
|
|
892
|
+
|
|
893
|
+
The activation function is defined as:
|
|
894
|
+
|
|
895
|
+
.. math::
|
|
896
|
+
\text{leaky_relu}(input) = \begin{cases}input, &\text{if } input \geq 0; \cr
|
|
897
|
+
\text{negative_slope} * input, &\text{otherwise.}\end{cases}
|
|
898
|
+
|
|
899
|
+
where :math:`negative\_slope` represents the `negative_slope` parameter.
|
|
900
|
+
|
|
901
|
+
For more details, see `Rectifier Nonlinearities Improve Neural Network Acoustic Models
|
|
902
|
+
<https://ai.stanford.edu/~amaas/papers/relu_hybrid_icml2013_final.pdf>`_.
|
|
903
|
+
|
|
904
|
+
LeakyReLU Activation Function Graph:
|
|
905
|
+
|
|
906
|
+
.. image:: ../images/LeakyReLU.png
|
|
907
|
+
:align: center
|
|
908
|
+
|
|
909
|
+
Args:
|
|
910
|
+
input (Tensor): The input of leaky_relu is a Tensor of any dimension.
|
|
911
|
+
negative_slope (Union[int, float]): Slope of the activation function when the element of `input` is less than 0.
|
|
912
|
+
Default: ``0.01`` .
|
|
913
|
+
|
|
914
|
+
Returns:
|
|
915
|
+
Tensor, has the same type and shape as the `input`.
|
|
916
|
+
|
|
917
|
+
Raises:
|
|
918
|
+
TypeError: If `input` is not a Tensor.
|
|
919
|
+
TypeError: If `negative_slope` is not a float or an int.
|
|
920
|
+
|
|
921
|
+
Supported Platforms:
|
|
922
|
+
``Ascend``
|
|
923
|
+
|
|
924
|
+
Examples:
|
|
925
|
+
>>> import mindspore
|
|
926
|
+
>>> import numpy as np
|
|
927
|
+
>>> from mindspore import Tensor, ops
|
|
928
|
+
>>> input = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32)
|
|
929
|
+
>>> print(ops.extend.leaky_relu_ext(input, negative_slope=0.2))
|
|
930
|
+
[[-0.2 4. -1.6]
|
|
931
|
+
[ 2. -1. 9. ]]
|
|
932
|
+
"""
|
|
933
|
+
return leaky_relu_impl(input, negative_slope)
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
def log_softmax(input, dim=None, dtype=None):
|
|
937
|
+
r"""
|
|
938
|
+
Applies the Log Softmax function to the input tensor on the specified axis.
|
|
939
|
+
Supposes a slice in the given axis, :math:`x` for each element :math:`x_i`,
|
|
940
|
+
the Log Softmax function is shown as follows:
|
|
941
|
+
|
|
942
|
+
.. math::
|
|
943
|
+
\text{output}(x_i) = \log \left(\frac{\exp(x_i)} {\sum_{j = 0}^{N-1}\exp(x_j)}\right),
|
|
944
|
+
|
|
945
|
+
where :math:`N` is the length of the Tensor.
|
|
946
|
+
|
|
947
|
+
Args:
|
|
948
|
+
input (Tensor): The input Tensor.
|
|
949
|
+
dim (int, optional): The axis to perform the Log softmax operation. Default: ``None`` .
|
|
950
|
+
|
|
951
|
+
Keyword Args:
|
|
952
|
+
dtype (:class:`mindspore.dtype`, optional): The desired dtype of returned Tensor. If not set to None, the input
|
|
953
|
+
Tensor will be cast to `dtype` before the operation is performed. This is useful for preventing overflows.
|
|
954
|
+
If set to None, stay the same as original Tensor. Default: ``None`` . Supported data type is {float16, float32, double, bfloat16}.
|
|
955
|
+
|
|
956
|
+
Returns:
|
|
957
|
+
Tensor, with the same shape as the input.
|
|
958
|
+
|
|
959
|
+
Raises:
|
|
960
|
+
TypeError: If `dim` is not an int.
|
|
961
|
+
ValueError: If `dim` is not in range [-len(input.shape), len(input.shape)).
|
|
962
|
+
|
|
963
|
+
Supported Platforms:
|
|
964
|
+
``Ascend``
|
|
965
|
+
|
|
966
|
+
Examples:
|
|
967
|
+
>>> import mindspore
|
|
968
|
+
>>> import numpy as np
|
|
969
|
+
>>> from mindspore import Tensor, ops
|
|
970
|
+
>>> logits = Tensor(np.array([1, 2, 3, 4, 5]), mindspore.float32)
|
|
971
|
+
>>> output = ops.auto_generate.log_softmax(logits, dim=-1)
|
|
972
|
+
>>> print(output)
|
|
973
|
+
[-4.4519143 -3.4519143 -2.4519143 -1.4519144 -0.4519144]
|
|
974
|
+
"""
|
|
975
|
+
return log_softmax_impl(input, dim, dtype)
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
def logaddexp(input, other):
|
|
979
|
+
r"""
|
|
980
|
+
Computes the logarithm of the sum of exponentiations of the inputs.
|
|
981
|
+
This function is useful in statistics where the calculated probabilities of events may be
|
|
982
|
+
so small as to exceed the range of normal floating point numbers.
|
|
983
|
+
|
|
984
|
+
.. math::
|
|
985
|
+
|
|
986
|
+
out_i = \log(exp(input_i) + \exp(other_i))
|
|
987
|
+
|
|
988
|
+
.. warning::
|
|
989
|
+
This is an experimental API that is subject to change or deletion.
|
|
990
|
+
|
|
991
|
+
Args:
|
|
992
|
+
input (Tensor): Input Tensor. The dtype of `input` must be float.
|
|
993
|
+
other (Tensor): Input Tensor. The dtype of `other` must be float.
|
|
994
|
+
If the shape of `input` is not equal to the shape of `other`,
|
|
995
|
+
they must be broadcastable to a common shape (which becomes the shape of the output).
|
|
996
|
+
|
|
997
|
+
Returns:
|
|
998
|
+
Tensor, with the same dtype as `input` and `other`.
|
|
999
|
+
|
|
1000
|
+
Raises:
|
|
1001
|
+
TypeError: If `input` or `other` is not a Tensor.
|
|
1002
|
+
TypeError: The dtype of `input` or `other` is not float.
|
|
1003
|
+
|
|
1004
|
+
Supported Platforms:
|
|
1005
|
+
``Ascend``
|
|
1006
|
+
|
|
1007
|
+
Examples:
|
|
1008
|
+
>>> import numpy as np
|
|
1009
|
+
>>> from mindspore import Tensor, ops
|
|
1010
|
+
>>> x1 = Tensor(np.array([1, 2, 3]).astype(np.float16))
|
|
1011
|
+
>>> x2 = Tensor(np.array(2).astype(np.float16))
|
|
1012
|
+
>>> output = ops.logaddexp_ext(x1, x2)
|
|
1013
|
+
>>> print(output)
|
|
1014
|
+
[2.312 2.693 3.312]
|
|
1015
|
+
"""
|
|
1016
|
+
return logaddexp_impl(input, other)
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
def matmul(input, mat2):
|
|
1020
|
+
r"""
|
|
1021
|
+
None
|
|
1022
|
+
"""
|
|
1023
|
+
return matmul_impl(input, mat2)
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
def matrix_inverse(input):
|
|
1027
|
+
r"""
|
|
1028
|
+
Compute the inverse of the input matrix.
|
|
1029
|
+
|
|
1030
|
+
Args:
|
|
1031
|
+
input (Tensor): A matrix to be calculated. Input `input` must be at least two dimensions, and the size of
|
|
1032
|
+
the last two dimensions must be the same size.
|
|
1033
|
+
|
|
1034
|
+
Returns:
|
|
1035
|
+
Tensor, has the same type and shape as input`.
|
|
1036
|
+
|
|
1037
|
+
Raises:
|
|
1038
|
+
TypeError: If `input` is not a Tensor.
|
|
1039
|
+
ValueError: If the size of the last two dimensions of `input` is not the same.
|
|
1040
|
+
ValueError: If the dimension of `input` is 1.
|
|
1041
|
+
|
|
1042
|
+
Supported Platforms:
|
|
1043
|
+
``Ascend``
|
|
1044
|
+
|
|
1045
|
+
Examples:
|
|
1046
|
+
>>> from mindspore import Tensor, ops
|
|
1047
|
+
>>> from mindspore import dtype as mstype
|
|
1048
|
+
>>> x = Tensor([[1., 2.], [3., 4.]], mstype.float32)
|
|
1049
|
+
>>> print(ops.matrix_inverse_ext(x))
|
|
1050
|
+
[[-2. 1. ]
|
|
1051
|
+
[ 1.5 -0.5]]
|
|
1052
|
+
"""
|
|
1053
|
+
return matrix_inverse_impl(input)
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
def mean(input, axis=None, keep_dims=False, dtype=None):
|
|
1057
|
+
r"""
|
|
1058
|
+
Reduces all dimension of a tensor by averaging all elements in the dimension, by default.
|
|
1059
|
+
And reduce a dimension of `input` along the specified `axis`. `keep_dims`
|
|
1060
|
+
determines whether the dimensions of the output and input are the same.
|
|
1061
|
+
|
|
1062
|
+
Note:
|
|
1063
|
+
The `axis` with tensor type is only used for compatibility with older versions and is not recommended.
|
|
1064
|
+
|
|
1065
|
+
Args:
|
|
1066
|
+
input (Tensor[Number]): The input tensor. The dtype of the tensor to be reduced is number.
|
|
1067
|
+
:math:`(N, *)` where :math:`*` means, any number of additional dimensions.
|
|
1068
|
+
axis (Union[int, tuple(int), list(int), Tensor]): The dimensions to reduce. Default: ``None`` ,
|
|
1069
|
+
reduce all dimensions. Only constant value is allowed. Assume the rank of `input` is r,
|
|
1070
|
+
and the value range is [-r,r).
|
|
1071
|
+
keep_dims (bool): If ``True`` , keep these reduced dimensions and the length is 1.
|
|
1072
|
+
If ``False`` , don't keep these dimensions. Default: ``False`` .
|
|
1073
|
+
dtype (:class:`mindspore.dtype`): The desired data type of returned Tensor. Default: ``None`` .
|
|
1074
|
+
|
|
1075
|
+
Returns:
|
|
1076
|
+
Tensor, has the same data type as input tensor.
|
|
1077
|
+
|
|
1078
|
+
- If `axis` is ``None`` , and `keep_dims` is ``False`` ,
|
|
1079
|
+
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
|
1080
|
+
- If `axis` is int, set as 1, and `keep_dims` is ``False`` ,
|
|
1081
|
+
the shape of output is :math:`(x_0, x_2, ..., x_R)`.
|
|
1082
|
+
- If `axis` is tuple(int), set as (1, 2), and `keep_dims` is ``False`` ,
|
|
1083
|
+
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
|
1084
|
+
- If `axis` is 1-D Tensor, set as [1, 2], and `keep_dims` is ``False`` ,
|
|
1085
|
+
the shape of output is :math:`(x_0, x_3, ..., x_R)`.
|
|
1086
|
+
|
|
1087
|
+
Raises:
|
|
1088
|
+
TypeError: If `x` is not a Tensor.
|
|
1089
|
+
TypeError: If `axis` is not one of the following: int, tuple, list or Tensor.
|
|
1090
|
+
TypeError: If `keep_dims` is not a bool.
|
|
1091
|
+
ValueError: If `axis` is out of range.
|
|
1092
|
+
|
|
1093
|
+
Supported Platforms:
|
|
1094
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1095
|
+
|
|
1096
|
+
Examples:
|
|
1097
|
+
>>> import mindspore
|
|
1098
|
+
>>> import numpy as np
|
|
1099
|
+
>>> from mindspore import Tensor, ops
|
|
1100
|
+
>>> x = Tensor(np.random.randn(3, 4, 5, 6).astype(np.float32))
|
|
1101
|
+
>>> output = ops.mean(x, 1, keep_dims=True)
|
|
1102
|
+
>>> result = output.shape
|
|
1103
|
+
>>> print(result)
|
|
1104
|
+
(3, 1, 5, 6)
|
|
1105
|
+
>>> # case 1: Reduces a dimension by averaging all elements in the dimension.
|
|
1106
|
+
>>> x = Tensor(np.array([[[2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2], [2, 2, 2, 2, 2, 2]],
|
|
1107
|
+
... [[4, 4, 4, 4, 4, 4], [5, 5, 5, 5, 5, 5], [6, 6, 6, 6, 6, 6]],
|
|
1108
|
+
... [[6, 6, 6, 6, 6, 6], [8, 8, 8, 8, 8, 8], [10, 10, 10, 10, 10, 10]]]),
|
|
1109
|
+
... mindspore.float32)
|
|
1110
|
+
>>> output = ops.mean(x)
|
|
1111
|
+
>>> print(output)
|
|
1112
|
+
5.0
|
|
1113
|
+
>>> print(output.shape)
|
|
1114
|
+
()
|
|
1115
|
+
>>> # case 2: Reduces a dimension along the axis 0
|
|
1116
|
+
>>> output = ops.mean(x, 0, True)
|
|
1117
|
+
>>> print(output)
|
|
1118
|
+
[[[4. 4. 4. 4. 4. 4.]
|
|
1119
|
+
[5. 5. 5. 5. 5. 5.]
|
|
1120
|
+
[6. 6. 6. 6. 6. 6.]]]
|
|
1121
|
+
>>> # case 3: Reduces a dimension along the axis 1
|
|
1122
|
+
>>> output = ops.mean(x, 1, True)
|
|
1123
|
+
>>> print(output)
|
|
1124
|
+
[[[2. 2. 2. 2. 2. 2.]]
|
|
1125
|
+
[[5. 5. 5. 5. 5. 5.]]
|
|
1126
|
+
[[8. 8. 8. 8. 8. 8.]]]
|
|
1127
|
+
>>> # case 4: Reduces a dimension along the axis 2
|
|
1128
|
+
>>> output = ops.mean(x, 2, True)
|
|
1129
|
+
>>> print(output)
|
|
1130
|
+
[[[ 2.]
|
|
1131
|
+
[ 2.]
|
|
1132
|
+
[ 2.]]
|
|
1133
|
+
[[ 4.]
|
|
1134
|
+
[ 5.]
|
|
1135
|
+
[ 6.]]
|
|
1136
|
+
[[ 6.]
|
|
1137
|
+
[ 8.]
|
|
1138
|
+
[10.]]]
|
|
1139
|
+
"""
|
|
1140
|
+
return mean_impl(input, axis, keep_dims, dtype)
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
def mish(input):
|
|
1144
|
+
r"""
|
|
1145
|
+
Computes MISH (A Self Regularized Non-Monotonic Neural Activation Function)
|
|
1146
|
+
of input tensors element-wise.
|
|
1147
|
+
|
|
1148
|
+
The formula is defined as follows:
|
|
1149
|
+
|
|
1150
|
+
.. math::
|
|
1151
|
+
\text{mish}(input) = input * \tanh(softplus(\text{input}))
|
|
1152
|
+
|
|
1153
|
+
See more details in `A Self Regularized Non-Monotonic Neural Activation Function
|
|
1154
|
+
<https://arxiv.org/abs/1908.08681>`_.
|
|
1155
|
+
|
|
1156
|
+
Mish Activation Function Graph:
|
|
1157
|
+
|
|
1158
|
+
.. image:: ../images/Mish.png
|
|
1159
|
+
:align: center
|
|
1160
|
+
|
|
1161
|
+
Args:
|
|
1162
|
+
input (Tensor): The input of MISH. Supported dtypes:
|
|
1163
|
+
|
|
1164
|
+
- Ascend: float16, float32.
|
|
1165
|
+
|
|
1166
|
+
Returns:
|
|
1167
|
+
Tensor, has the same type and shape as the `input`.
|
|
1168
|
+
|
|
1169
|
+
Raises:
|
|
1170
|
+
TypeError: If `input` is not a Tensor.
|
|
1171
|
+
TypeError: If dtype of `input` is not float16 or float32.
|
|
1172
|
+
|
|
1173
|
+
Supported Platforms:
|
|
1174
|
+
``Ascend``
|
|
1175
|
+
|
|
1176
|
+
Examples:
|
|
1177
|
+
>>> import mindspore
|
|
1178
|
+
>>> from mindspore import Tensor, ops
|
|
1179
|
+
>>> import numpy as np
|
|
1180
|
+
>>> x = Tensor(np.array([[-1.1, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32)
|
|
1181
|
+
>>> output = ops.mish(x)
|
|
1182
|
+
>>> print(output)
|
|
1183
|
+
[[-3.0764845e-01 3.9974124e+00 -2.6832507e-03]
|
|
1184
|
+
[ 1.9439589e+00 -3.3576239e-02 8.9999990e+00]]
|
|
1185
|
+
"""
|
|
1186
|
+
return mish_impl(input)
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
def mse_loss(input, target, reduction='mean'):
|
|
1190
|
+
r"""
|
|
1191
|
+
Calculates the mean squared error between the predicted value and the label value.
|
|
1192
|
+
|
|
1193
|
+
For detailed information, please refer to :class:`mindspore.nn.MSELoss`.
|
|
1194
|
+
|
|
1195
|
+
Args:
|
|
1196
|
+
input (Tensor): Tensor of any dimension. The data type needs to be consistent with the `target`.
|
|
1197
|
+
It should also be broadcastable with the `target`.
|
|
1198
|
+
target (Tensor): The input label. Tensor of any dimension. The data type needs to be consistent with the `input`.
|
|
1199
|
+
It should also be broadcastable with the `input`.
|
|
1200
|
+
reduction (str, optional): Apply specific reduction method to the output: ``'mean'`` , ``'none'`` ,
|
|
1201
|
+
``'sum'`` . Default: ``'mean'`` .
|
|
1202
|
+
|
|
1203
|
+
- ``'none'``: no reduction will be applied.
|
|
1204
|
+
- ``'mean'``: compute and return the mean of elements in the output.
|
|
1205
|
+
- ``'sum'``: the output elements will be summed.
|
|
1206
|
+
|
|
1207
|
+
Returns:
|
|
1208
|
+
- Tensor. If `reduction` is ``'mean'`` or ``'sum'``, the shape of output is `Tensor Scalar`.
|
|
1209
|
+
- If reduction is ``'none'``, the shape of output is the broadcasted shape of **input** and **target** .
|
|
1210
|
+
|
|
1211
|
+
Raises:
|
|
1212
|
+
ValueError: If `reduction` is not one of ``'mean'`` , ``'sum'`` or ``'none'``.
|
|
1213
|
+
ValueError: If `input` and `target` are not broadcastable.
|
|
1214
|
+
TypeError: If `input` and `target` are in different data type.
|
|
1215
|
+
|
|
1216
|
+
Supported Platforms:
|
|
1217
|
+
``Ascend``
|
|
1218
|
+
|
|
1219
|
+
Examples:
|
|
1220
|
+
>>> import mindspore
|
|
1221
|
+
>>> import numpy as np
|
|
1222
|
+
>>> from mindspore import Tensor, ops
|
|
1223
|
+
>>> logits = Tensor(np.array([1, 2, 3]), mindspore.float32)
|
|
1224
|
+
>>> labels = Tensor(np.array([[1, 1, 1], [1, 2, 2]]), mindspore.float32)
|
|
1225
|
+
>>> output = ops.mse_loss_ext(logits, labels, reduction='none')
|
|
1226
|
+
>>> print(output)
|
|
1227
|
+
[[0. 1. 4.]
|
|
1228
|
+
[0. 0. 1.]]
|
|
1229
|
+
"""
|
|
1230
|
+
return mse_loss_impl(input, target, converted_reduction)
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
def outer(input, vec2):
|
|
1234
|
+
r"""
|
|
1235
|
+
Return outer product of `input` and `vec2`. If `input` is a vector of size :math:`n`
|
|
1236
|
+
and `vec2` is a vector of size :math:`m` , then output must be a matrix of shape :math:`(n, m)` .
|
|
1237
|
+
|
|
1238
|
+
.. warning::
|
|
1239
|
+
This is an experimental API that is subject to change or deletion.
|
|
1240
|
+
|
|
1241
|
+
.. note::
|
|
1242
|
+
This function does not broadcast.
|
|
1243
|
+
|
|
1244
|
+
Args:
|
|
1245
|
+
input (Tensor): 1-D input vector.
|
|
1246
|
+
vec2 (Tensor): 1-D input vector.
|
|
1247
|
+
|
|
1248
|
+
Returns:
|
|
1249
|
+
out, 2-D matrix, the outer product of two vectors.
|
|
1250
|
+
|
|
1251
|
+
Raises:
|
|
1252
|
+
TypeError: If `input` or `vec2` is not a Tensor.
|
|
1253
|
+
TypeError: The implicitly converted data types of `input` and `vec2` are not one of float16, float32, float64, bool, uint8, int8, int16, int32, int64, complex64, complex128, bfloat16
|
|
1254
|
+
ValueError: If the dimension of `input` or `vec2` is not equal to 1.
|
|
1255
|
+
|
|
1256
|
+
Supported Platforms:
|
|
1257
|
+
``Ascend``
|
|
1258
|
+
|
|
1259
|
+
Examples:
|
|
1260
|
+
>>> import mindspore
|
|
1261
|
+
>>> import numpy as np
|
|
1262
|
+
>>> from mindspore import Tensor
|
|
1263
|
+
>>> from mindspore import ops
|
|
1264
|
+
>>> input = Tensor(np.array([7, 8, 9]), mindspore.int32)
|
|
1265
|
+
>>> vec2 = Tensor(np.array([7, 10, 11]), mindspore.int32)
|
|
1266
|
+
>>> out = ops.outer(input, vec2)
|
|
1267
|
+
>>> print(out)
|
|
1268
|
+
[[49 70 77]
|
|
1269
|
+
[56 80 88]
|
|
1270
|
+
[63 90 99]]
|
|
1271
|
+
"""
|
|
1272
|
+
return outer_impl(input, vec2)
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
def prod(input, axis=None, keep_dims=False, dtype=None):
|
|
1276
|
+
r"""
|
|
1277
|
+
Reduces a dimension of a tensor by multiplying all elements in the dimension, by default. And also can
|
|
1278
|
+
reduce a dimension of `input` along the `axis`. Determine whether the dimensions of the output and input are the
|
|
1279
|
+
same by controlling `keep_dims`.
|
|
1280
|
+
|
|
1281
|
+
Args:
|
|
1282
|
+
input (Tensor[Number]): The input tensor. The dtype of the tensor to be reduced is number.
|
|
1283
|
+
:math:`(N, *)` where :math:`*` means, any number of additional dimensions.
|
|
1284
|
+
axis (int): The dimensions to reduce. Default: ``None`` , reduce all dimensions.
|
|
1285
|
+
Only constant value is allowed. Assume the rank of `input` is r, and the value range is [-r,r).
|
|
1286
|
+
keep_dims (bool): If ``True`` , keep these reduced dimensions and the length is 1.
|
|
1287
|
+
If ``False`` , don't keep these dimensions. Default: ``False`` .
|
|
1288
|
+
dtype (:class:`mindspore.dtype`): The desired data type of returned Tensor. Default: ``None`` .
|
|
1289
|
+
|
|
1290
|
+
Returns:
|
|
1291
|
+
Tensor, has the same data type as input tensor.
|
|
1292
|
+
|
|
1293
|
+
- If `axis` is ``None`` , and `keep_dims` is ``False`` ,
|
|
1294
|
+
the output is a 0-D tensor representing the product of all elements in the input tensor.
|
|
1295
|
+
- If `axis` is int, set as 1, and `keep_dims` is ``False`` ,
|
|
1296
|
+
the shape of output is :math:`(input_0, input_2, ..., input_R)`.
|
|
1297
|
+
|
|
1298
|
+
Raises:
|
|
1299
|
+
TypeError: If `input` is not a Tensor.
|
|
1300
|
+
TypeError: If `axis` is not one of the following: int or None.
|
|
1301
|
+
TypeError: If `keep_dims` is not a bool.
|
|
1302
|
+
ValueError: If `axis` is out of range.
|
|
1303
|
+
|
|
1304
|
+
Supported Platforms:
|
|
1305
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1306
|
+
|
|
1307
|
+
Examples:
|
|
1308
|
+
>>> import mindspore
|
|
1309
|
+
>>> import numpy as np
|
|
1310
|
+
>>> from mindspore import Tensor, ops
|
|
1311
|
+
>>> x = Tensor(np.random.randn(3, 4, 5, 6).astype(np.float32))
|
|
1312
|
+
>>> output = ops.ProdExt()(x, 1, keep_dims=True)
|
|
1313
|
+
>>> result = output.shape
|
|
1314
|
+
>>> print(result)
|
|
1315
|
+
(3, 1, 5, 6)
|
|
1316
|
+
>>> # case 1: Reduces a dimension by multiplying all elements in the dimension.
|
|
1317
|
+
>>> x = Tensor(np.array([[[1, 1, 1, 1, 1, 1], [2, 2, 2, 2, 2, 2], [3, 3, 3, 3, 3, 3]],
|
|
1318
|
+
... [[4, 4, 4, 4, 4, 4], [5, 5, 5, 5, 5, 5], [6, 6, 6, 6, 6, 6]],
|
|
1319
|
+
... [[7, 7, 7, 7, 7, 7], [8, 8, 8, 8, 8, 8], [9, 9, 9, 9, 9, 9]]]), mindspore.float32)
|
|
1320
|
+
>>> output = ops.ProdExt()(x)
|
|
1321
|
+
>>> print(output)
|
|
1322
|
+
2.2833798e+33
|
|
1323
|
+
>>> print(output.shape)
|
|
1324
|
+
()
|
|
1325
|
+
>>> # case 2: Reduces a dimension along axis 0.
|
|
1326
|
+
>>> output = ops.ProdExt()(x, 0, True)
|
|
1327
|
+
>>> print(output)
|
|
1328
|
+
[[[ 28. 28. 28. 28. 28. 28.]
|
|
1329
|
+
[ 80. 80. 80. 80. 80. 80.]
|
|
1330
|
+
[162. 162. 162. 162. 162. 162.]]]
|
|
1331
|
+
>>> # case 3: Reduces a dimension along axis 1.
|
|
1332
|
+
>>> output = ops.ProdExt()(x, 1, True)
|
|
1333
|
+
>>> print(output)
|
|
1334
|
+
[[[ 6. 6. 6. 6. 6. 6.]]
|
|
1335
|
+
[[120. 120. 120. 120. 120. 120.]]
|
|
1336
|
+
[[504. 504. 504. 504. 504. 504.]]]
|
|
1337
|
+
>>> # case 4: Reduces a dimension along axis 2.
|
|
1338
|
+
>>> output = ops.ProdExt()(x, 2, True)
|
|
1339
|
+
>>> print(output)
|
|
1340
|
+
[[[1.00000e+00]
|
|
1341
|
+
[6.40000e+01]
|
|
1342
|
+
[7.29000e+02]]
|
|
1343
|
+
[[4.09600e+03]
|
|
1344
|
+
[1.56250e+04]
|
|
1345
|
+
[4.66560e+04]]
|
|
1346
|
+
[[1.17649e+05]
|
|
1347
|
+
[2.62144e+05]
|
|
1348
|
+
[5.31441e+05]]]
|
|
1349
|
+
"""
|
|
1350
|
+
return prod_impl(input, axis, keep_dims, dtype)
|
|
1351
|
+
|
|
1352
|
+
|
|
1353
|
+
def selu(input):
|
|
1354
|
+
r"""
|
|
1355
|
+
Activation function SELU (Scaled exponential Linear Unit).
|
|
1356
|
+
|
|
1357
|
+
The activation function is defined as:
|
|
1358
|
+
|
|
1359
|
+
.. math::
|
|
1360
|
+
E_{i} =
|
|
1361
|
+
scale *
|
|
1362
|
+
\begin{cases}
|
|
1363
|
+
x_{i}, &\text{if } x_{i} \geq 0; \cr
|
|
1364
|
+
\text{alpha} * (\exp(x_i) - 1), &\text{otherwise.}
|
|
1365
|
+
\end{cases}
|
|
1366
|
+
|
|
1367
|
+
where :math:`alpha` and :math:`scale` are pre-defined constants(:math:`alpha=1.67326324`
|
|
1368
|
+
and :math:`scale=1.05070098`).
|
|
1369
|
+
|
|
1370
|
+
See more details in `Self-Normalizing Neural Networks <https://arxiv.org/abs/1706.02515>`_.
|
|
1371
|
+
|
|
1372
|
+
SELU Activation Function Graph:
|
|
1373
|
+
|
|
1374
|
+
.. image:: ../images/SeLU.png
|
|
1375
|
+
:align: center
|
|
1376
|
+
|
|
1377
|
+
Args:
|
|
1378
|
+
input (Tensor): Tensor of any dimension.
|
|
1379
|
+
The data type is float16, float32, bfloat16.
|
|
1380
|
+
|
|
1381
|
+
Returns:
|
|
1382
|
+
Tensor, with the same type and shape as the `input`.
|
|
1383
|
+
|
|
1384
|
+
Raises:
|
|
1385
|
+
TypeError: If dtype of `input` is not float16, float32, bfloat16.
|
|
1386
|
+
|
|
1387
|
+
Supported Platforms:
|
|
1388
|
+
``Ascend``
|
|
1389
|
+
|
|
1390
|
+
Examples:
|
|
1391
|
+
>>> import mindspore
|
|
1392
|
+
>>> from mindspore import Tensor, mint
|
|
1393
|
+
>>> import numpy as np
|
|
1394
|
+
>>> input = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32)
|
|
1395
|
+
>>> output = mint.nn.functional.selu(input)
|
|
1396
|
+
>>> print(output)
|
|
1397
|
+
[[-1.1113307 4.202804 -1.7575096]
|
|
1398
|
+
[ 2.101402 -1.7462534 9.456309 ]]
|
|
1399
|
+
"""
|
|
1400
|
+
return selu_impl(input)
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
def softplus(input, beta=1, threshold=20):
|
|
1404
|
+
r"""
|
|
1405
|
+
Applies softplus function to `input` element-wise.
|
|
1406
|
+
|
|
1407
|
+
The softplus function is shown as follows, x is the element of `input` :
|
|
1408
|
+
|
|
1409
|
+
.. math::
|
|
1410
|
+
|
|
1411
|
+
\text{output} = \frac{1}{beta}\log(1 + \exp(\text{beta * x}))
|
|
1412
|
+
|
|
1413
|
+
where :math:`input * beta > threshold`, the implementation converts to the linear function to ensure numerical stability.
|
|
1414
|
+
|
|
1415
|
+
Args:
|
|
1416
|
+
input (Tensor): Tensor of any dimension. Supported dtypes:
|
|
1417
|
+
|
|
1418
|
+
- Ascend: float16, float32, bfloat16.
|
|
1419
|
+
beta (number.Number, optional): Scaling parameters in the softplus function. Default: ``1`` .
|
|
1420
|
+
threshold (number.Number, optional): For numerical stability, the softplus function is converted
|
|
1421
|
+
to a threshold parameter of a linear function. Default: ``20`` .
|
|
1422
|
+
|
|
1423
|
+
Returns:
|
|
1424
|
+
Tensor, with the same type and shape as the input.
|
|
1425
|
+
|
|
1426
|
+
Raises:
|
|
1427
|
+
TypeError: If `input` is not a Tensor.
|
|
1428
|
+
TypeError: If dtype of `input` is not float16, float32, bfloat16.
|
|
1429
|
+
|
|
1430
|
+
Supported Platforms:
|
|
1431
|
+
``Ascend``
|
|
1432
|
+
|
|
1433
|
+
Examples:
|
|
1434
|
+
>>> import mindspore
|
|
1435
|
+
>>> import numpy as np
|
|
1436
|
+
>>> from mindspore import Tensor, ops
|
|
1437
|
+
>>> input = Tensor(np.array([0.1, 0.2, 30, 25]), mindspore.float32)
|
|
1438
|
+
>>> output = ops.auto_generate.softplus_ext(input)
|
|
1439
|
+
>>> print(output)
|
|
1440
|
+
[0.74439657 0.7981388 30. 25.]
|
|
1441
|
+
"""
|
|
1442
|
+
return softplus_impl(input, beta, threshold)
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
def sort(input, dim=-1, descending=False, stable=False):
|
|
1446
|
+
r"""
|
|
1447
|
+
None
|
|
1448
|
+
"""
|
|
1449
|
+
return sort_impl(input, dim, descending, stable)
|
|
1450
|
+
|
|
1451
|
+
|
|
1452
|
+
def stack(tensors, dim=0):
|
|
1453
|
+
r"""
|
|
1454
|
+
Stacks a list of tensors in specified dim.
|
|
1455
|
+
|
|
1456
|
+
Stacks the list of input tensors with the same rank `R`, output is a tensor of rank `(R+1)`.
|
|
1457
|
+
|
|
1458
|
+
Given input tensors of shape :math:`(x_1, x_2, ..., x_R)`. Set the number of input tensors as `N`.
|
|
1459
|
+
If :math:`dim \ge 0`, the shape of the output tensor is
|
|
1460
|
+
:math:`(x_1, x_2, ..., x_{dim}, N, x_{dim+1}, ..., x_R)`.
|
|
1461
|
+
|
|
1462
|
+
Args:
|
|
1463
|
+
tensors (Union[tuple, list]): A Tuple or list of Tensor objects with the same shape and type.
|
|
1464
|
+
dim (int): Dimension to stack. The range is [-(R+1), R+1). Default: ``0`` .
|
|
1465
|
+
|
|
1466
|
+
Returns:
|
|
1467
|
+
Tensor. A stacked Tensor with the same type as `tensors`.
|
|
1468
|
+
|
|
1469
|
+
Raises:
|
|
1470
|
+
TypeError: If the data types of elements in `tensors` are not the same.
|
|
1471
|
+
ValueError: If `dim` is out of the range [-(R+1), R+1);
|
|
1472
|
+
or if the shapes of elements in tensors are not the same.
|
|
1473
|
+
|
|
1474
|
+
Supported Platforms:
|
|
1475
|
+
``Ascend``
|
|
1476
|
+
|
|
1477
|
+
Examples:
|
|
1478
|
+
>>> import mindspore
|
|
1479
|
+
>>> from mindspore import Tensor, ops
|
|
1480
|
+
>>> import numpy as np
|
|
1481
|
+
>>> data1 = Tensor(np.array([0, 1]).astype(np.float32))
|
|
1482
|
+
>>> data2 = Tensor(np.array([2, 3]).astype(np.float32))
|
|
1483
|
+
>>> output = ops.auto_generate.stack_ext([data1, data2], 0)
|
|
1484
|
+
>>> print(output)
|
|
1485
|
+
[[0. 1.]
|
|
1486
|
+
[2. 3.]]
|
|
1487
|
+
"""
|
|
1488
|
+
return stack_impl(tensors, dim)
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
def sub(input, other, alpha=1):
|
|
1492
|
+
r"""
|
|
1493
|
+
Subtracts scaled other value from input Tensor.
|
|
1494
|
+
|
|
1495
|
+
.. math::
|
|
1496
|
+
|
|
1497
|
+
out_{i} = input_{i} - alpha \times other_{i}
|
|
1498
|
+
|
|
1499
|
+
Note:
|
|
1500
|
+
- When the two inputs have different shapes,
|
|
1501
|
+
they must be able to broadcast to a common shape.
|
|
1502
|
+
- The two inputs and alpha comply with the implicit type conversion rules to make the data types
|
|
1503
|
+
consistent.
|
|
1504
|
+
|
|
1505
|
+
Args:
|
|
1506
|
+
input (Union[Tensor, number.Number, bool]): The first input is a number.Number or
|
|
1507
|
+
a bool or a tensor whose data type is
|
|
1508
|
+
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
1509
|
+
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
1510
|
+
other (Union[Tensor, number.Number, bool]): The second input, is a number.Number or
|
|
1511
|
+
a bool or a tensor whose data type is
|
|
1512
|
+
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
1513
|
+
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
1514
|
+
alpha (number.Number): A scaling factor applied to `other`, default 1.
|
|
1515
|
+
|
|
1516
|
+
Returns:
|
|
1517
|
+
Tensor with a shape that is the same as the broadcasted shape of the input `input` and `other`,
|
|
1518
|
+
and the data type is the one with higher precision or higher digits among the two inputs and alpha.
|
|
1519
|
+
|
|
1520
|
+
Raises:
|
|
1521
|
+
TypeError: If the type of `input`, `other`, or `alpha` is not one of the following: Tensor, number.Number, bool.
|
|
1522
|
+
TypeError: If `alpha` is of type float but `input` and `other` are not of type float.
|
|
1523
|
+
TypeError: If `alpha` is of type bool but `input` and `other` are not of type bool.
|
|
1524
|
+
|
|
1525
|
+
Supported Platforms:
|
|
1526
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1527
|
+
|
|
1528
|
+
Examples:
|
|
1529
|
+
>>> import numpy as np
|
|
1530
|
+
>>> import mindspore
|
|
1531
|
+
>>> from mindspore import Tensor
|
|
1532
|
+
>>> from mindspore import ops
|
|
1533
|
+
>>> x = Tensor(np.array([4, 5, 6]).astype(np.float32))
|
|
1534
|
+
>>> y = Tensor(1, mindspore.int32)
|
|
1535
|
+
>>> alpha = 0.5
|
|
1536
|
+
>>> output = ops.auto_generate.sub_ext(x, y, alpha)
|
|
1537
|
+
>>> print(output)
|
|
1538
|
+
[3.5 4.5 5.5]
|
|
1539
|
+
>>> # the data type of x is float32, the data type of y is int32,
|
|
1540
|
+
>>> # alpha is a float, and the output is the data format of higher precision float32.
|
|
1541
|
+
>>> print(output.dtype)
|
|
1542
|
+
Float32
|
|
1543
|
+
"""
|
|
1544
|
+
return sub_impl(input, other, alpha)
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
def topk(input, k, dim=-1, largest=True, sorted=True):
|
|
1548
|
+
r"""
|
|
1549
|
+
Finds values and indices of the `k` largest or smallest entries along a given dimension.
|
|
1550
|
+
|
|
1551
|
+
.. warning::
|
|
1552
|
+
- If sorted is set to False, due to different memory layout and traversal methods on different platforms,
|
|
1553
|
+
the display order of calculation results may be inconsistent when `sorted` is False.
|
|
1554
|
+
|
|
1555
|
+
If the `input` is a one-dimensional Tensor, finds the `k` largest or smallest entries in the Tensor,
|
|
1556
|
+
and outputs its value and index as a Tensor. values[`k`] is the `k` largest item in `input`,
|
|
1557
|
+
and its index is indices [`k`].
|
|
1558
|
+
|
|
1559
|
+
For a multi-dimensional matrix,
|
|
1560
|
+
calculates the first or last `k` entries in a given dimension, therefore:
|
|
1561
|
+
|
|
1562
|
+
.. math::
|
|
1563
|
+
|
|
1564
|
+
values.shape = indices.shape
|
|
1565
|
+
|
|
1566
|
+
If the two compared elements are the same, the one with the smaller index value is returned first.
|
|
1567
|
+
|
|
1568
|
+
Args:
|
|
1569
|
+
input (Tensor): Input to be computed.
|
|
1570
|
+
k (int): The number of top or bottom elements to be computed along the last dimension.
|
|
1571
|
+
dim (int, optional): The dimension to sort along. Default: ``-1`` .
|
|
1572
|
+
largest (bool, optional): If largest is ``False`` then the k smallest elements are returned.
|
|
1573
|
+
Default: ``True`` .
|
|
1574
|
+
sorted (bool, optional): If ``True`` , the obtained elements will be sorted by the values in descending
|
|
1575
|
+
order or ascending order according to `largest`. If ``False`` , the obtained elements will not be
|
|
1576
|
+
sorted. Default: ``True`` .
|
|
1577
|
+
|
|
1578
|
+
Returns:
|
|
1579
|
+
A tuple consisting of `values` and `indices`.
|
|
1580
|
+
|
|
1581
|
+
- values (Tensor) - The `k` largest or smallest elements in each slice of the given dimension.
|
|
1582
|
+
- indices (Tensor) - The indices of values within the last dimension of input.
|
|
1583
|
+
|
|
1584
|
+
Raises:
|
|
1585
|
+
TypeError: If `sorted` is not a bool.
|
|
1586
|
+
TypeError: If `input` is not a Tensor.
|
|
1587
|
+
TypeError: If `k` is not an int.
|
|
1588
|
+
|
|
1589
|
+
Supported Platforms:
|
|
1590
|
+
``Ascend``
|
|
1591
|
+
|
|
1592
|
+
Examples:
|
|
1593
|
+
>>> import mindspore as ms
|
|
1594
|
+
>>> from mindspore import ops
|
|
1595
|
+
>>> x = ms.Tensor([[0.5368, 0.2447, 0.4302, 0.9673],
|
|
1596
|
+
... [0.4388, 0.6525, 0.4685, 0.1868],
|
|
1597
|
+
... [0.3563, 0.5152, 0.9675, 0.8230]], dtype=ms.float32)
|
|
1598
|
+
>>> output = ops.topk_ext(x, 2, dim=1)
|
|
1599
|
+
>>> print(output)
|
|
1600
|
+
(Tensor(shape=[3, 2], dtype=Float32, value=
|
|
1601
|
+
[[ 9.67299998e-01, 5.36800027e-01],
|
|
1602
|
+
[ 6.52499974e-01, 4.68499988e-01],
|
|
1603
|
+
[ 9.67499971e-01, 8.23000014e-01]]), Tensor(shape=[3, 2], dtype=Int32, value=
|
|
1604
|
+
[[3, 0],
|
|
1605
|
+
[1, 2],
|
|
1606
|
+
[2, 3]]))
|
|
1607
|
+
>>> output2 = ops.topk_ext(x, 2, dim=1, largest=False)
|
|
1608
|
+
>>> print(output2)
|
|
1609
|
+
(Tensor(shape=[3, 2], dtype=Float32, value=
|
|
1610
|
+
[[ 2.44700000e-01, 4.30200011e-01],
|
|
1611
|
+
[ 1.86800003e-01, 4.38800007e-01],
|
|
1612
|
+
[ 3.56299996e-01, 5.15200019e-01]]), Tensor(shape=[3, 2], dtype=Int32, value=
|
|
1613
|
+
[[1, 2],
|
|
1614
|
+
[3, 0],
|
|
1615
|
+
[0, 1]]))
|
|
1616
|
+
"""
|
|
1617
|
+
return topk_impl(input, k, dim, largest, sorted)
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
def trace(input):
|
|
1621
|
+
r"""
|
|
1622
|
+
Returns a new tensor that is the sum of the `input` main trace.
|
|
1623
|
+
|
|
1624
|
+
Note:
|
|
1625
|
+
Input must be tensor.
|
|
1626
|
+
|
|
1627
|
+
Args:
|
|
1628
|
+
input (Tensor): 2-D Tensor.
|
|
1629
|
+
|
|
1630
|
+
Returns:
|
|
1631
|
+
Tensor, when the data type of `input` is integer or bool, its data type is int64, otherwise it is the same as `input`, and size equals to 1.
|
|
1632
|
+
|
|
1633
|
+
Raises:
|
|
1634
|
+
TypeError: If `input` is not a Tensor.
|
|
1635
|
+
ValueError: If the dimension of `input` is not equal to 2.
|
|
1636
|
+
TypeError: If the dtype of `input` is not one of float16, float32, float64, bool, uint8, int8, int16, int32, int64, complex64, complex128, bfloat16.
|
|
1637
|
+
|
|
1638
|
+
Supported Platforms:
|
|
1639
|
+
``Ascend``
|
|
1640
|
+
|
|
1641
|
+
Examples:
|
|
1642
|
+
>>> import mindspore
|
|
1643
|
+
>>> import numpy as np
|
|
1644
|
+
>>> from mindspore import Tensor, ops
|
|
1645
|
+
>>> input = Tensor(np.array([[10, 11, 12], [13, 14, 15], [16, 17, 18]]), mindspore.float32)
|
|
1646
|
+
>>> output = ops.trace_ext(input)
|
|
1647
|
+
>>> print(output)
|
|
1648
|
+
42.0
|
|
1649
|
+
>>> input = Tensor(np.arange(1, 13).reshape(3, 4), mindspore.float32)
|
|
1650
|
+
>>> output = ops.trace_ext(input)
|
|
1651
|
+
>>> print(output)
|
|
1652
|
+
18.0
|
|
1653
|
+
>>> input = Tensor(np.arange(12, 0, -1).reshape(4, 3), mindspore.float32)
|
|
1654
|
+
>>> output = ops.trace_ext(input)
|
|
1655
|
+
>>> print(output)
|
|
1656
|
+
24.0
|
|
1657
|
+
"""
|
|
1658
|
+
return trace_impl(input)
|
|
1659
|
+
|
|
1660
|
+
|
|
1661
|
+
def transpose(input, dim0, dim1):
|
|
1662
|
+
r"""
|
|
1663
|
+
Interchange two axes of a tensor.
|
|
1664
|
+
|
|
1665
|
+
.. warning::
|
|
1666
|
+
This is an experimental API that is subject to change or deletion.
|
|
1667
|
+
|
|
1668
|
+
Args:
|
|
1669
|
+
input(Tensor): Input tensor.
|
|
1670
|
+
dim0 (int): First axis.
|
|
1671
|
+
dim1 (int): Second axis.
|
|
1672
|
+
|
|
1673
|
+
Returns:
|
|
1674
|
+
Transposed tensor, has the same data type as `input`.
|
|
1675
|
+
|
|
1676
|
+
Raises:
|
|
1677
|
+
TypeError: If argument `input` is not Tensor.
|
|
1678
|
+
TypeError: If `dim0` or `dim1` is not integer.
|
|
1679
|
+
ValueError: If `dim0` or `dim1` is not in the range of :math:`[-ndim, ndim-1]`.
|
|
1680
|
+
|
|
1681
|
+
Supported Platforms:
|
|
1682
|
+
``Ascend``
|
|
1683
|
+
|
|
1684
|
+
Examples:
|
|
1685
|
+
>>> import numpy as np
|
|
1686
|
+
>>> from mindspore import mint
|
|
1687
|
+
>>> from mindspore import Tensor
|
|
1688
|
+
>>> input = Tensor(np.ones((2,3,4), dtype=np.float32))
|
|
1689
|
+
>>> output = mint.transpose(input, 0, 2)
|
|
1690
|
+
>>> print(output.shape)
|
|
1691
|
+
(4, 3, 2)
|
|
1692
|
+
"""
|
|
1693
|
+
return transpose_impl(input, dim0, dim1)
|
|
1694
|
+
|
|
1695
|
+
|
|
1696
|
+
def tril(input, diagonal=0):
|
|
1697
|
+
r"""
|
|
1698
|
+
None
|
|
1699
|
+
"""
|
|
1700
|
+
return tril_impl(input, diagonal)
|
|
1701
|
+
|