mindspore 2.0.0rc1__cp38-none-any.whl → 2.2.0__cp38-none-any.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/Third_Party_Open_Source_Software_Notice +2 -2
- mindspore/__init__.py +5 -2
- mindspore/_akg/akg/build_module.py +5 -6
- mindspore/_akg/akg/composite/build_module.py +49 -16
- mindspore/_akg/akg/composite/split_stitch.py +10 -11
- mindspore/_akg/akg/config/repository.json +195 -0
- mindspore/_akg/akg/global_configs.py +5 -1
- mindspore/_akg/akg/ms/info_version_adapt.py +67 -1
- mindspore/_akg/akg/tvm/api.py +4 -3
- mindspore/_akg/akg/tvm/autotvm/__init__.py +1 -2
- mindspore/_akg/akg/tvm/autotvm/graph_tuner/base_graph_tuner.py +1 -5
- mindspore/_akg/akg/tvm/autotvm/measure/__init__.py +1 -1
- mindspore/_akg/akg/tvm/autotvm/measure/measure.py +1 -10
- mindspore/_akg/akg/tvm/autotvm/measure/measure_methods.py +1 -372
- mindspore/_akg/akg/tvm/build_module.py +16 -1
- mindspore/_akg/akg/tvm/contrib/graph_runtime.py +0 -53
- mindspore/_akg/akg/tvm/hybrid/parser.py +7 -6
- mindspore/_akg/akg/tvm/ir_builder.py +1 -1
- mindspore/_akg/akg/tvm/module.py +1 -2
- mindspore/_akg/akg/tvm/stmt.py +2 -2
- mindspore/_akg/akg/utils/composite_op_helper.py +9 -10
- mindspore/_akg/akg/utils/kernel_exec.py +58 -260
- mindspore/_akg/akg/utils/op_dsl.py +17 -1
- mindspore/_akg/akg/utils/result_analysis.py +4 -24
- mindspore/_akg/akg/utils/tbe_codegen_utils.py +198 -0
- mindspore/_c_dataengine.cpython-38-aarch64-linux-gnu.so +0 -0
- mindspore/_c_expression.cpython-38-aarch64-linux-gnu.so +0 -0
- mindspore/_c_mindrecord.cpython-38-aarch64-linux-gnu.so +0 -0
- mindspore/_check_jit_forbidden_api.py +5 -1
- mindspore/_checkparam.py +79 -62
- mindspore/_extends/graph_kernel/__init__.py +0 -1
- mindspore/_extends/graph_kernel/model/graph_split.py +2 -0
- mindspore/_extends/graph_kernel/model/model_builder.py +9 -50
- mindspore/_extends/graph_kernel/splitter.py +1 -9
- mindspore/_extends/parallel_compile/akg_compiler/akg_process.py +128 -21
- mindspore/_extends/parallel_compile/akg_compiler/build_tbe_kernel.py +2 -2
- mindspore/_extends/parallel_compile/akg_compiler/tbe_topi.py +4 -2
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_adapter.py +18 -13
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_helper.py +13 -9
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_job.py +1 -1
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_job_manager.py +1 -1
- mindspore/_extends/parse/__init__.py +19 -17
- mindspore/_extends/parse/namespace.py +7 -36
- mindspore/_extends/parse/parser.py +375 -189
- mindspore/_extends/parse/resources.py +36 -41
- mindspore/_extends/parse/standard_method.py +350 -245
- mindspore/_extends/parse/trope.py +2 -12
- mindspore/_extends/remote/kernel_build_server.py +24 -7
- mindspore/_extends/remote/kernel_build_server_akg_v2.py +55 -0
- mindspore/_install_custom.py +43 -0
- mindspore/_mindspore_offline_debug.cpython-38-aarch64-linux-gnu.so +0 -0
- mindspore/amp.py +85 -19
- mindspore/bin/cache_admin +0 -0
- mindspore/bin/cache_server +0 -0
- mindspore/boost/base.py +2 -2
- mindspore/boost/boost.py +27 -32
- mindspore/boost/boost_cell_wrapper.py +37 -13
- mindspore/boost/grad_accumulation.py +1 -1
- mindspore/boost/grad_freeze.py +34 -6
- mindspore/boost/group_loss_scale_manager.py +15 -14
- mindspore/boost/less_batch_normalization.py +28 -3
- mindspore/common/__init__.py +15 -11
- mindspore/common/_auto_dynamic.py +68 -0
- mindspore/common/_jit_fallback_utils.py +111 -0
- mindspore/common/_register_for_adapter.py +17 -5
- mindspore/common/_register_for_tensor.py +2 -2
- mindspore/common/_stub_tensor.py +18 -15
- mindspore/common/_utils.py +31 -7
- mindspore/common/api.py +269 -101
- mindspore/common/auto_dynamic_shape.py +498 -0
- mindspore/common/dtype.py +61 -21
- mindspore/common/dump.py +9 -7
- mindspore/common/initializer.py +106 -76
- mindspore/common/jit_config.py +35 -14
- mindspore/common/lazy_inline.py +187 -0
- mindspore/common/mindir_util.py +101 -0
- mindspore/common/mutable.py +10 -13
- mindspore/common/parameter.py +246 -55
- mindspore/common/seed.py +13 -7
- mindspore/common/sparse_tensor.py +29 -33
- mindspore/common/tensor.py +907 -251
- mindspore/communication/__init__.py +7 -4
- mindspore/communication/_comm_helper.py +84 -4
- mindspore/communication/management.py +160 -88
- mindspore/config/op_info.config +99 -75
- mindspore/config/super_bar_config.json +36 -4
- mindspore/context.py +526 -219
- mindspore/dataset/__init__.py +9 -46
- mindspore/dataset/audio/__init__.py +4 -19
- mindspore/dataset/audio/transforms.py +545 -233
- mindspore/dataset/audio/utils.py +21 -18
- mindspore/dataset/callback/ds_callback.py +42 -13
- mindspore/dataset/core/config.py +158 -100
- mindspore/dataset/core/validator_helpers.py +1 -63
- mindspore/dataset/debug/debug_hook.py +45 -13
- mindspore/dataset/debug/pre_defined_hook.py +5 -5
- mindspore/dataset/engine/__init__.py +0 -5
- mindspore/dataset/engine/cache_client.py +38 -15
- mindspore/dataset/engine/datasets.py +615 -278
- mindspore/dataset/engine/datasets_audio.py +154 -283
- mindspore/dataset/engine/datasets_standard_format.py +104 -116
- mindspore/dataset/engine/datasets_text.py +443 -326
- mindspore/dataset/engine/datasets_user_defined.py +251 -164
- mindspore/dataset/engine/datasets_vision.py +839 -1443
- mindspore/dataset/engine/iterators.py +11 -4
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +7 -3
- mindspore/dataset/engine/obs/util.py +3 -0
- mindspore/dataset/engine/offload.py +6 -6
- mindspore/dataset/engine/queue.py +15 -14
- mindspore/dataset/engine/samplers.py +39 -23
- mindspore/dataset/engine/serializer_deserializer.py +22 -6
- mindspore/dataset/engine/validators.py +21 -331
- mindspore/dataset/text/__init__.py +5 -33
- mindspore/dataset/text/transforms.py +334 -165
- mindspore/dataset/text/utils.py +215 -145
- mindspore/dataset/transforms/__init__.py +1 -1
- mindspore/dataset/transforms/c_transforms.py +3 -2
- mindspore/dataset/transforms/py_transforms_util.py +40 -12
- mindspore/dataset/transforms/transforms.py +174 -71
- mindspore/dataset/utils/browse_dataset.py +25 -17
- mindspore/dataset/utils/line_reader.py +24 -21
- mindspore/dataset/vision/__init__.py +5 -26
- mindspore/dataset/vision/c_transforms.py +177 -165
- mindspore/dataset/vision/py_transforms.py +114 -119
- mindspore/dataset/vision/py_transforms_util.py +54 -51
- mindspore/dataset/vision/transforms.py +1127 -381
- mindspore/dataset/vision/utils.py +54 -38
- mindspore/dataset/vision/validators.py +12 -2
- mindspore/experimental/map_parameter.py +38 -4
- mindspore/{dataset/datapreprocess → experimental/optim}/__init__.py +14 -4
- mindspore/experimental/optim/adam.py +192 -0
- mindspore/experimental/optim/adamw.py +181 -0
- mindspore/experimental/optim/lr_scheduler.py +1427 -0
- mindspore/experimental/optim/optimizer.py +252 -0
- mindspore/experimental/optim/sgd.py +147 -0
- mindspore/gen_ops.py +273 -0
- mindspore/include/OWNERS +1 -2
- mindspore/include/api/context.h +21 -1
- mindspore/include/api/data_type.h +2 -1
- mindspore/include/api/graph.h +0 -15
- mindspore/include/api/kernel.h +2 -0
- mindspore/include/api/kernel_api.h +37 -12
- mindspore/include/api/model.h +29 -42
- mindspore/include/api/model_group.h +14 -3
- mindspore/include/api/model_parallel_runner.h +18 -2
- mindspore/include/api/serialization.h +26 -0
- mindspore/include/api/status.h +1 -0
- mindspore/include/api/types.h +38 -4
- mindspore/include/c_api/ms/abstract.h +67 -0
- mindspore/include/c_api/ms/attribute.h +197 -0
- mindspore/include/c_api/ms/base/handle_types.h +43 -0
- mindspore/include/c_api/ms/base/macros.h +32 -0
- mindspore/include/c_api/ms/base/status.h +33 -0
- mindspore/include/c_api/ms/base/types.h +282 -0
- mindspore/include/c_api/ms/context.h +102 -0
- mindspore/include/c_api/ms/graph.h +160 -0
- mindspore/include/c_api/ms/node.h +606 -0
- mindspore/include/c_api/ms/tensor.h +161 -0
- mindspore/include/c_api/ms/value.h +84 -0
- mindspore/include/c_api/status_c.h +3 -0
- mindspore/include/dataset/constants.h +6 -12
- mindspore/include/dataset/execute.h +23 -13
- mindspore/include/dataset/text.h +26 -26
- mindspore/include/dataset/transforms.h +25 -31
- mindspore/include/dataset/vision.h +60 -60
- mindspore/include/dataset/vision_ascend.h +5 -6
- mindspore/include/dataset/vision_lite.h +17 -17
- mindspore/include/mindapi/base/format.h +0 -1
- mindspore/include/mindapi/base/type_id.h +2 -1
- mindspore/include/mindapi/base/types.h +5 -1
- mindspore/lib/libdnnl.so.2 +0 -0
- mindspore/lib/libjemalloc.so.2 +0 -0
- mindspore/lib/libmindspore.so +0 -0
- mindspore/lib/libmindspore_backend.so +0 -0
- mindspore/lib/libmindspore_common.so +0 -0
- mindspore/lib/libmindspore_core.so +0 -0
- mindspore/lib/libmindspore_glog.so.0 +0 -0
- mindspore/lib/libmindspore_gpr.so.15 +0 -0
- mindspore/lib/libmindspore_grpc++.so.1 +0 -0
- mindspore/lib/libmindspore_grpc.so.15 +0 -0
- mindspore/lib/libmindspore_shared_lib.so +0 -0
- mindspore/lib/libmpi_adapter.so +0 -0
- mindspore/lib/libnnacl.so +0 -0
- mindspore/lib/libopencv_core.so.4.5 +0 -0
- mindspore/lib/libopencv_imgcodecs.so.4.5 +0 -0
- mindspore/lib/libopencv_imgproc.so.4.5 +0 -0
- mindspore/lib/libps_cache.so +0 -0
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_aicpu_kernels.so +0 -0
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_cpu_kernels.so +0 -0
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/config/cust_aicpu_kernel.json +9000 -0
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
- mindspore/lib/plugin/ascend/libakg.so +0 -0
- mindspore/lib/plugin/ascend/libascend_collective.so +0 -0
- mindspore/lib/plugin/ascend/libdvpp_utils.so +0 -0
- mindspore/lib/plugin/ascend/libhccl_plugin.so +0 -0
- mindspore/lib/plugin/ascend/libmindspore_aicpu_kernels.so +0 -0
- mindspore/lib/plugin/ascend/libmindspore_cpu_kernels.so +0 -0
- mindspore/lib/plugin/cpu/libakg.so +0 -0
- mindspore/lib/plugin/libmindspore_ascend.so.1 +0 -0
- mindspore/lib/plugin/libmindspore_ascend.so.2 +0 -0
- mindspore/log.py +9 -6
- mindspore/mindrecord/filereader.py +33 -4
- mindspore/mindrecord/filewriter.py +70 -35
- mindspore/mindrecord/mindpage.py +40 -34
- mindspore/mindrecord/shardreader.py +1 -1
- mindspore/mindrecord/shardsegment.py +1 -1
- mindspore/mindrecord/tools/cifar100_to_mr.py +25 -18
- mindspore/mindrecord/tools/cifar10_to_mr.py +25 -18
- mindspore/mindrecord/tools/csv_to_mr.py +29 -13
- mindspore/mindrecord/tools/imagenet_to_mr.py +24 -10
- mindspore/mindrecord/tools/mnist_to_mr.py +24 -11
- mindspore/mindrecord/tools/tfrecord_to_mr.py +31 -26
- mindspore/nn/cell.py +463 -169
- mindspore/nn/dynamic_lr.py +47 -43
- mindspore/nn/layer/activation.py +225 -82
- mindspore/nn/layer/basic.py +121 -79
- mindspore/nn/layer/channel_shuffle.py +21 -21
- mindspore/nn/layer/combined.py +33 -26
- mindspore/nn/layer/container.py +277 -22
- mindspore/nn/layer/conv.py +441 -304
- mindspore/nn/layer/dense.py +19 -13
- mindspore/nn/layer/embedding.py +62 -49
- mindspore/nn/layer/flash_attention.py +264 -0
- mindspore/nn/layer/image.py +50 -39
- mindspore/nn/layer/math.py +62 -51
- mindspore/nn/layer/normalization.py +219 -167
- mindspore/nn/layer/padding.py +58 -70
- mindspore/nn/layer/pooling.py +334 -287
- mindspore/nn/layer/rnn_cells.py +53 -38
- mindspore/nn/layer/rnns.py +59 -56
- mindspore/nn/layer/thor_layer.py +52 -44
- mindspore/nn/layer/timedistributed.py +6 -4
- mindspore/nn/layer/transformer.py +284 -164
- mindspore/nn/learning_rate_schedule.py +34 -25
- mindspore/nn/loss/__init__.py +3 -2
- mindspore/nn/loss/loss.py +554 -311
- mindspore/nn/optim/ada_grad.py +12 -9
- mindspore/nn/optim/adadelta.py +14 -11
- mindspore/nn/optim/adafactor.py +19 -16
- mindspore/nn/optim/adam.py +62 -47
- mindspore/nn/optim/adamax.py +13 -10
- mindspore/nn/optim/adasum.py +12 -8
- mindspore/nn/optim/asgd.py +10 -9
- mindspore/nn/optim/ftrl.py +20 -17
- mindspore/nn/optim/lamb.py +16 -12
- mindspore/nn/optim/lars.py +8 -6
- mindspore/nn/optim/lazyadam.py +25 -20
- mindspore/nn/optim/momentum.py +10 -7
- mindspore/nn/optim/optimizer.py +61 -9
- mindspore/nn/optim/proximal_ada_grad.py +14 -13
- mindspore/nn/optim/rmsprop.py +17 -13
- mindspore/nn/optim/rprop.py +30 -17
- mindspore/nn/optim/sgd.py +40 -23
- mindspore/nn/optim/thor.py +24 -26
- mindspore/nn/probability/bijector/bijector.py +11 -11
- mindspore/nn/probability/bijector/exp.py +1 -1
- mindspore/nn/probability/bijector/gumbel_cdf.py +3 -3
- mindspore/nn/probability/bijector/invert.py +1 -1
- mindspore/nn/probability/bijector/power_transform.py +29 -29
- mindspore/nn/probability/bijector/scalar_affine.py +3 -3
- mindspore/nn/probability/bijector/softplus.py +5 -5
- mindspore/nn/probability/bnn_layers/bnn_cell_wrapper.py +4 -2
- mindspore/nn/probability/bnn_layers/conv_variational.py +13 -13
- mindspore/nn/probability/bnn_layers/dense_variational.py +12 -12
- mindspore/nn/probability/bnn_layers/layer_distribution.py +9 -8
- mindspore/nn/probability/distribution/_utils/custom_ops.py +19 -3
- mindspore/nn/probability/distribution/_utils/utils.py +1 -1
- mindspore/nn/probability/distribution/bernoulli.py +9 -9
- mindspore/nn/probability/distribution/beta.py +8 -8
- mindspore/nn/probability/distribution/categorical.py +23 -15
- mindspore/nn/probability/distribution/cauchy.py +5 -6
- mindspore/nn/probability/distribution/distribution.py +3 -3
- mindspore/nn/probability/distribution/exponential.py +4 -4
- mindspore/nn/probability/distribution/gamma.py +10 -10
- mindspore/nn/probability/distribution/geometric.py +8 -8
- mindspore/nn/probability/distribution/gumbel.py +8 -9
- mindspore/nn/probability/distribution/half_normal.py +5 -5
- mindspore/nn/probability/distribution/laplace.py +5 -5
- mindspore/nn/probability/distribution/log_normal.py +12 -11
- mindspore/nn/probability/distribution/logistic.py +8 -8
- mindspore/nn/probability/distribution/normal.py +6 -5
- mindspore/nn/probability/distribution/poisson.py +10 -11
- mindspore/nn/probability/distribution/student_t.py +8 -9
- mindspore/nn/probability/distribution/transformed_distribution.py +5 -5
- mindspore/nn/probability/distribution/uniform.py +11 -11
- mindspore/nn/reinforcement/tensor_array.py +2 -2
- mindspore/nn/sparse/sparse.py +9 -9
- mindspore/nn/wrap/cell_wrapper.py +188 -63
- mindspore/nn/wrap/grad_reducer.py +21 -12
- mindspore/nn/wrap/loss_scale.py +136 -49
- mindspore/numpy/__init__.py +4 -4
- mindspore/numpy/array_creations.py +55 -56
- mindspore/numpy/array_ops.py +134 -35
- mindspore/numpy/logic_ops.py +66 -20
- mindspore/numpy/math_ops.py +142 -139
- mindspore/numpy/utils_const.py +2 -2
- mindspore/offline_debug/convert_async.py +2 -2
- mindspore/ops/_grad_experimental/__init__.py +7 -5
- mindspore/ops/_grad_experimental/grad_array_ops.py +231 -348
- mindspore/ops/{_grad → _grad_experimental}/grad_base.py +1 -33
- mindspore/ops/{_grad → _grad_experimental}/grad_comm_ops.py +25 -13
- mindspore/ops/{_grad/__init__.py → _grad_experimental/grad_debug_ops.py} +15 -7
- mindspore/ops/{_grad → _grad_experimental}/grad_implementations.py +17 -11
- mindspore/ops/_grad_experimental/grad_inner_ops.py +33 -52
- mindspore/ops/_grad_experimental/grad_math_ops.py +151 -1224
- mindspore/ops/_grad_experimental/grad_nn_ops.py +141 -414
- mindspore/ops/{_grad → _grad_experimental}/grad_quant_ops.py +10 -6
- mindspore/ops/_grad_experimental/grad_sparse.py +317 -2
- mindspore/ops/_grad_experimental/grad_sparse_ops.py +3 -13
- mindspore/ops/{_grad → _grad_experimental}/taylor_rule.py +1 -1
- mindspore/ops/_op_impl/_custom_op/dsd_back_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/flash_attention/__init__.py +0 -0
- mindspore/ops/_op_impl/_custom_op/flash_attention/attention.py +406 -0
- mindspore/{_extends/graph_kernel/expanders/complex/__init__.py → ops/_op_impl/_custom_op/flash_attention/constants.py} +27 -8
- mindspore/ops/_op_impl/_custom_op/flash_attention/flash_attention_bwd.py +467 -0
- mindspore/ops/_op_impl/_custom_op/flash_attention/flash_attention_fwd.py +563 -0
- mindspore/ops/_op_impl/_custom_op/flash_attention/flash_attention_impl.py +193 -0
- mindspore/ops/_op_impl/_custom_op/flash_attention/tik_ops_utils.py +435 -0
- mindspore/ops/_op_impl/_custom_op/flash_attention/tiling_strategy/__init__.py +0 -0
- mindspore/ops/_op_impl/_custom_op/flash_attention/tiling_strategy/sparse_tiling.py +45 -0
- mindspore/ops/_op_impl/_custom_op/flash_attention/tiling_strategy/strategy.py +67 -0
- mindspore/ops/_op_impl/_custom_op/flash_attention/tiling_strategy/wukong_tiling.py +62 -0
- mindspore/ops/_op_impl/_custom_op/matmul_cube_dense_left_impl.py +2 -2
- mindspore/ops/_op_impl/aicpu/__init__.py +41 -1
- mindspore/ops/_op_impl/aicpu/adaptive_max_pool_2d.py +37 -0
- mindspore/ops/_op_impl/aicpu/bias_add_grad.py +0 -1
- mindspore/ops/_op_impl/aicpu/cast.py +52 -0
- mindspore/ops/_op_impl/aicpu/coalesce.py +2 -0
- mindspore/ops/_op_impl/aicpu/col2im.py +3 -1
- mindspore/ops/_op_impl/aicpu/count_nonzero.py +43 -0
- mindspore/ops/_op_impl/aicpu/dropout_genmask.py +6 -0
- mindspore/ops/_op_impl/aicpu/eps.py +32 -0
- mindspore/ops/_op_impl/aicpu/eye.py +4 -4
- mindspore/ops/_op_impl/aicpu/fft_with_size.py +6 -0
- mindspore/ops/_op_impl/aicpu/fill_diagonal.py +5 -0
- mindspore/ops/_op_impl/aicpu/gamma.py +2 -2
- mindspore/ops/_op_impl/aicpu/im2col.py +3 -5
- mindspore/ops/_op_impl/aicpu/lgamma.py +1 -0
- mindspore/ops/_op_impl/aicpu/log_uniform_candidate_sampler.py +6 -3
- mindspore/ops/_op_impl/aicpu/lu.py +39 -0
- mindspore/ops/_op_impl/aicpu/lu_unpack_grad.py +0 -1
- mindspore/ops/_op_impl/aicpu/masked_scatter.py +1 -0
- mindspore/ops/_op_impl/aicpu/masked_select_grad.py +3 -0
- mindspore/ops/_op_impl/aicpu/matrix_band_part.py +59 -0
- mindspore/ops/_op_impl/aicpu/matrix_power.py +6 -1
- mindspore/ops/_op_impl/aicpu/median.py +1 -0
- mindspore/ops/_op_impl/aicpu/multinomial.py +9 -9
- mindspore/ops/_op_impl/aicpu/not_equal.py +0 -5
- mindspore/ops/_op_impl/aicpu/pad_v3.py +3 -1
- mindspore/ops/_op_impl/aicpu/pad_v3_grad.py +2 -0
- mindspore/ops/_op_impl/aicpu/parameterized_truncated_normal.py +15 -7
- mindspore/ops/_op_impl/aicpu/random_categorical.py +39 -19
- mindspore/ops/_op_impl/aicpu/random_choice_with_mask.py +5 -2
- mindspore/ops/_op_impl/aicpu/random_poisson.py +103 -52
- mindspore/ops/_op_impl/aicpu/random_shuffle.py +17 -15
- mindspore/ops/_op_impl/aicpu/resize_bilinear_grad.py +0 -1
- mindspore/ops/_op_impl/aicpu/resize_nearest_neighbor_v2.py +0 -6
- mindspore/ops/_op_impl/aicpu/resize_nearest_neighbor_v2_grad.py +0 -7
- mindspore/ops/_op_impl/aicpu/scatter_nd.py +2 -0
- mindspore/ops/_op_impl/aicpu/sequence_concat.py +40 -0
- mindspore/ops/_op_impl/aicpu/sequence_stack.py +40 -0
- mindspore/ops/_op_impl/aicpu/{sparseaddmm.py → sparse_addmm.py} +2 -2
- mindspore/ops/_op_impl/aicpu/{sparsesparsemaximum.py → sparse_sparse_maximum.py} +4 -4
- mindspore/ops/_op_impl/aicpu/standard_laplace.py +5 -4
- mindspore/ops/_op_impl/aicpu/standard_normal.py +5 -4
- mindspore/ops/_op_impl/aicpu/truncated_normal.py +9 -7
- mindspore/ops/_op_impl/aicpu/uniform.py +5 -3
- mindspore/ops/_op_impl/aicpu/uniform_candidate_sampler.py +8 -4
- mindspore/ops/_op_impl/aicpu/uniform_int.py +5 -5
- mindspore/ops/_op_impl/aicpu/uniform_real.py +4 -4
- mindspore/ops/_op_impl/aicpu/upsample_nearest_3d.py +14 -6
- mindspore/ops/_op_impl/aicpu/upsample_nearest_3d_grad.py +22 -8
- mindspore/ops/_op_impl/aicpu/upsample_trilinear_3d.py +11 -6
- mindspore/ops/_op_impl/aicpu/upsample_trilinear_3d_grad.py +21 -10
- mindspore/ops/_op_impl/tbe/__init__.py +6 -4
- mindspore/ops/_op_impl/tbe/atomic_addr_clean.py +1 -1
- mindspore/ops/_op_impl/tbe/avg_pool.py +2 -2
- mindspore/ops/_op_impl/tbe/avg_pool_3d.py +3 -3
- mindspore/ops/_op_impl/tbe/avg_pool_3d_grad.py +4 -4
- mindspore/ops/_op_impl/tbe/avg_pool_ds.py +2 -2
- mindspore/ops/_op_impl/tbe/avg_pool_grad.py +3 -3
- mindspore/ops/_op_impl/tbe/avg_pool_grad_vm.py +3 -3
- mindspore/ops/_op_impl/tbe/batch_to_space.py +1 -1
- mindspore/ops/_op_impl/tbe/batch_to_space_nd.py +2 -2
- mindspore/ops/_op_impl/tbe/bn_infer.py +2 -2
- mindspore/ops/_op_impl/tbe/bn_infer_ds.py +3 -2
- mindspore/ops/_op_impl/tbe/broadcast_to.py +1 -1
- mindspore/ops/_op_impl/tbe/depthwise_conv2d.py +3 -3
- mindspore/ops/_op_impl/tbe/expand_dims.py +1 -1
- mindspore/ops/_op_impl/tbe/gather_v2.py +56 -0
- mindspore/ops/_op_impl/tbe/im2col.py +4 -4
- mindspore/ops/_op_impl/tbe/inplace_index_add.py +7 -3
- mindspore/ops/_op_impl/tbe/mem_set.py +38 -0
- mindspore/ops/_op_impl/tbe/scatter_nd_add.py +3 -0
- mindspore/ops/_op_impl/tbe/scatter_nd_d.py +1 -1
- mindspore/ops/_op_impl/tbe/space_to_batch.py +1 -1
- mindspore/ops/_op_impl/tbe/space_to_batch_nd.py +2 -2
- mindspore/ops/_op_impl/tbe/trans_data_ds.py +2 -0
- mindspore/ops/_primitive_cache.py +1 -1
- mindspore/ops/_tracefunc.py +241 -0
- mindspore/ops/_utils/utils.py +10 -2
- mindspore/ops/_vmap/vmap_array_ops.py +5 -3
- mindspore/ops/_vmap/vmap_base.py +5 -4
- mindspore/ops/_vmap/vmap_convolution_ops.py +1 -1
- mindspore/ops/_vmap/vmap_grad_math_ops.py +6 -4
- mindspore/ops/_vmap/vmap_grad_nn_ops.py +11 -6
- mindspore/ops/_vmap/vmap_math_ops.py +5 -2
- mindspore/ops/_vmap/vmap_nn_ops.py +135 -11
- mindspore/ops/arg_dtype_cast.py +54 -0
- mindspore/ops/composite/__init__.py +7 -5
- mindspore/ops/composite/base.py +78 -34
- mindspore/ops/composite/math_ops.py +5 -695
- mindspore/ops/composite/multitype_ops/_compile_utils.py +403 -97
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +28 -22
- mindspore/ops/composite/multitype_ops/add_impl.py +69 -7
- mindspore/ops/composite/multitype_ops/bitwise_and_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/bitwise_or_impl.py +2 -1
- mindspore/ops/composite/multitype_ops/bitwise_xor_impl.py +2 -0
- mindspore/ops/composite/multitype_ops/div_impl.py +1 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +1 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +48 -10
- mindspore/ops/composite/multitype_ops/greater_equal_impl.py +2 -0
- mindspore/ops/composite/multitype_ops/greater_impl.py +2 -0
- mindspore/ops/composite/multitype_ops/left_shift_impl.py +2 -0
- mindspore/ops/composite/multitype_ops/less_equal_impl.py +2 -0
- mindspore/ops/composite/multitype_ops/less_impl.py +2 -0
- mindspore/ops/composite/multitype_ops/logic_not_impl.py +2 -2
- mindspore/ops/composite/multitype_ops/mod_impl.py +1 -0
- mindspore/ops/composite/multitype_ops/mul_impl.py +1 -0
- mindspore/ops/composite/multitype_ops/negative_impl.py +1 -0
- mindspore/ops/composite/multitype_ops/not_in_impl.py +1 -0
- mindspore/ops/composite/multitype_ops/ones_like_impl.py +6 -0
- mindspore/ops/composite/multitype_ops/pow_impl.py +1 -0
- mindspore/ops/composite/multitype_ops/right_shift_impl.py +2 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +10 -7
- mindspore/ops/composite/multitype_ops/sub_impl.py +1 -0
- mindspore/ops/composite/multitype_ops/uadd_impl.py +2 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +9 -0
- mindspore/ops/deprecated.py +304 -0
- mindspore/ops/function/__init__.py +41 -4
- mindspore/ops/function/array_func.py +1108 -467
- mindspore/ops/function/clip_func.py +94 -27
- mindspore/ops/function/debug_func.py +3 -1
- mindspore/ops/function/grad/grad_func.py +82 -73
- mindspore/ops/function/image_func.py +28 -12
- mindspore/ops/function/linalg_func.py +135 -39
- mindspore/ops/function/math_func.py +3779 -894
- mindspore/ops/function/nn_func.py +1584 -657
- mindspore/ops/function/parameter_func.py +13 -3
- mindspore/ops/function/random_func.py +247 -153
- mindspore/ops/function/sparse_func.py +14 -11
- mindspore/ops/function/sparse_unary_func.py +173 -47
- mindspore/ops/function/spectral_func.py +8 -4
- mindspore/ops/function/vmap_func.py +8 -7
- mindspore/ops/functional.py +47 -16
- mindspore/ops/op_info_register.py +346 -86
- mindspore/ops/operations/__init__.py +38 -22
- mindspore/ops/operations/_grad_ops.py +145 -149
- mindspore/ops/operations/_inner_ops.py +298 -56
- mindspore/ops/operations/_ms_kernel.py +3 -3
- mindspore/ops/operations/_quant_ops.py +24 -28
- mindspore/ops/operations/_rl_inner_ops.py +9 -7
- mindspore/ops/operations/_scalar_ops.py +115 -0
- mindspore/ops/operations/_sequence_ops.py +148 -10
- mindspore/ops/operations/_tensor_array.py +1 -1
- mindspore/ops/operations/_thor_ops.py +2 -2
- mindspore/ops/operations/array_ops.py +1239 -561
- mindspore/ops/operations/comm_ops.py +166 -90
- mindspore/ops/operations/control_ops.py +3 -3
- mindspore/ops/operations/custom_ops.py +124 -102
- mindspore/ops/operations/debug_ops.py +24 -11
- mindspore/ops/operations/image_ops.py +86 -71
- mindspore/ops/operations/inner_ops.py +18 -13
- mindspore/ops/operations/linalg_ops.py +30 -11
- mindspore/ops/operations/math_ops.py +1730 -435
- mindspore/ops/operations/nn_ops.py +1953 -943
- mindspore/ops/operations/other_ops.py +65 -43
- mindspore/ops/operations/random_ops.py +258 -98
- mindspore/ops/operations/rl_ops.py +4 -36
- mindspore/ops/operations/sparse_ops.py +38 -33
- mindspore/ops/operations/spectral_ops.py +8 -4
- mindspore/ops/primitive.py +66 -44
- mindspore/ops/signature.py +5 -5
- mindspore/parallel/_auto_parallel_context.py +80 -19
- mindspore/parallel/_cost_model_context.py +42 -0
- mindspore/parallel/_offload_context.py +162 -72
- mindspore/parallel/_parallel_serialization.py +2 -2
- mindspore/parallel/_ps_context.py +16 -4
- mindspore/parallel/_recovery_context.py +2 -1
- mindspore/parallel/_tensor.py +15 -13
- mindspore/parallel/_transformer/layers.py +8 -6
- mindspore/parallel/_transformer/loss.py +1 -0
- mindspore/parallel/_transformer/moe.py +7 -7
- mindspore/parallel/_transformer/op_parallel_config.py +12 -1
- mindspore/parallel/_transformer/transformer.py +34 -14
- mindspore/parallel/_utils.py +36 -14
- mindspore/parallel/algo_parameter_config.py +114 -20
- mindspore/parallel/checkpoint_transform.py +16 -18
- mindspore/parallel/shard.py +16 -13
- mindspore/profiler/__init__.py +1 -1
- mindspore/profiler/common/struct_type.py +3 -3
- mindspore/profiler/common/util.py +3 -2
- mindspore/profiler/envprofiling.py +11 -4
- mindspore/profiler/parser/aicpu_data_parser.py +5 -3
- mindspore/profiler/parser/ascend_flops_generator.py +94 -0
- mindspore/profiler/parser/ascend_fpbp_generator.py +76 -0
- mindspore/profiler/parser/ascend_hccl_generator.py +288 -0
- mindspore/profiler/parser/ascend_msprof_exporter.py +213 -0
- mindspore/profiler/parser/ascend_msprof_generator.py +199 -0
- mindspore/profiler/parser/ascend_op_generator.py +276 -0
- mindspore/profiler/parser/ascend_steptrace_generator.py +94 -0
- mindspore/profiler/parser/ascend_timeline_generator.py +110 -54
- mindspore/profiler/parser/base_timeline_generator.py +11 -7
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +45 -46
- mindspore/profiler/parser/flops_parser.py +15 -11
- mindspore/profiler/parser/framework_parser.py +92 -73
- mindspore/profiler/parser/hccl_parser.py +16 -12
- mindspore/profiler/parser/integrator.py +22 -11
- mindspore/profiler/parser/memory_usage_parser.py +36 -11
- mindspore/profiler/parser/minddata_analyzer.py +12 -14
- mindspore/profiler/parser/minddata_pipeline_parser.py +1 -1
- mindspore/profiler/parser/msadvisor_parser.py +8 -4
- mindspore/profiler/parser/op_intermediate_parser.py +5 -2
- mindspore/profiler/parser/optime_parser.py +1 -1
- mindspore/profiler/parser/profiler_info.py +4 -5
- mindspore/profiler/parser/step_trace_parser.py +11 -14
- mindspore/profiler/profiling.py +678 -377
- mindspore/rewrite/api/node.py +211 -54
- mindspore/rewrite/api/node_type.py +5 -0
- mindspore/rewrite/api/pattern_engine.py +22 -23
- mindspore/rewrite/api/scoped_value.py +20 -17
- mindspore/rewrite/api/symbol_tree.py +252 -106
- mindspore/rewrite/api/tree_node_helper.py +3 -0
- mindspore/rewrite/ast_helpers/__init__.py +2 -1
- mindspore/rewrite/ast_helpers/ast_finder.py +129 -0
- mindspore/rewrite/ast_helpers/ast_modifier.py +116 -104
- mindspore/rewrite/ast_transformers/flatten_recursive_stmt.py +97 -46
- mindspore/rewrite/common/rewrite_elog.py +5 -1
- mindspore/rewrite/namer.py +51 -51
- mindspore/rewrite/namespace.py +14 -5
- mindspore/{ops/bprop_mindir → rewrite/node}/__init__.py +9 -4
- mindspore/rewrite/node/call_function.py +79 -0
- mindspore/rewrite/node/cell_container.py +135 -0
- mindspore/rewrite/node/control_flow.py +88 -0
- mindspore/rewrite/{node.py → node/node.py} +313 -247
- mindspore/rewrite/node/node_manager.py +254 -0
- mindspore/rewrite/node/node_topological_manager.py +243 -0
- mindspore/rewrite/parsers/arguments_parser.py +22 -21
- mindspore/rewrite/parsers/assign_parser.py +225 -239
- mindspore/rewrite/parsers/attribute_parser.py +9 -7
- mindspore/rewrite/parsers/class_def_parser.py +179 -218
- mindspore/rewrite/parsers/constant_parser.py +9 -6
- mindspore/rewrite/parsers/container_parser.py +9 -7
- mindspore/rewrite/parsers/for_parser.py +36 -15
- mindspore/rewrite/parsers/function_def_parser.py +23 -20
- mindspore/rewrite/parsers/if_parser.py +28 -24
- mindspore/rewrite/parsers/module_parser.py +202 -25
- mindspore/rewrite/{parser.py → parsers/parser.py} +4 -2
- mindspore/rewrite/{parser_register.py → parsers/parser_register.py} +1 -1
- mindspore/rewrite/parsers/return_parser.py +6 -6
- mindspore/rewrite/sparsify/sparse_transformer.py +12 -3
- mindspore/rewrite/sparsify/sparsify.py +4 -1
- mindspore/rewrite/sparsify/utils.py +11 -5
- mindspore/rewrite/symbol_tree.py +577 -732
- mindspore/rewrite/symbol_tree_builder.py +9 -175
- mindspore/rewrite/symbol_tree_dumper.py +2 -2
- mindspore/run_check/_check_version.py +46 -39
- mindspore/run_check/run_check.py +3 -2
- mindspore/{scipy/sparse → safeguard}/__init__.py +4 -5
- mindspore/safeguard/rewrite_obfuscation.py +517 -0
- mindspore/scipy/__init__.py +1 -1
- mindspore/scipy/linalg.py +67 -61
- mindspore/scipy/ops.py +5 -41
- mindspore/scipy/ops_grad.py +3 -2
- mindspore/scipy/ops_wrapper.py +5 -5
- mindspore/scipy/optimize/line_search.py +8 -8
- mindspore/scipy/optimize/linear_sum_assignment.py +4 -4
- mindspore/scipy/optimize/minimize.py +16 -12
- mindspore/scipy/utils.py +1 -52
- mindspore/scipy/utils_const.py +4 -4
- mindspore/train/__init__.py +4 -4
- mindspore/train/_utils.py +13 -5
- mindspore/train/amp.py +410 -148
- mindspore/train/anf_ir_pb2.py +16 -4
- mindspore/train/callback/_backup_and_restore.py +8 -11
- mindspore/train/callback/_callback.py +80 -3
- mindspore/train/callback/_checkpoint.py +82 -51
- mindspore/train/callback/_early_stop.py +12 -15
- mindspore/train/callback/_history.py +1 -1
- mindspore/train/callback/_lambda_callback.py +13 -13
- mindspore/train/callback/_landscape.py +21 -17
- mindspore/train/callback/_loss_monitor.py +9 -10
- mindspore/train/callback/_on_request_exit.py +16 -33
- mindspore/train/callback/_reduce_lr_on_plateau.py +21 -24
- mindspore/train/callback/_summary_collector.py +44 -30
- mindspore/train/callback/_time_monitor.py +62 -12
- mindspore/train/data_sink.py +10 -16
- mindspore/train/dataset_helper.py +154 -86
- mindspore/train/loss_scale_manager.py +14 -9
- mindspore/train/metrics/__init__.py +10 -2
- mindspore/train/metrics/accuracy.py +1 -1
- mindspore/train/metrics/auc.py +1 -1
- mindspore/train/metrics/bleu_score.py +2 -2
- mindspore/train/metrics/confusion_matrix.py +14 -14
- mindspore/train/metrics/cosine_similarity.py +3 -3
- mindspore/train/metrics/dice.py +1 -1
- mindspore/train/metrics/fbeta.py +1 -1
- mindspore/train/metrics/hausdorff_distance.py +8 -6
- mindspore/train/metrics/mean_surface_distance.py +5 -4
- mindspore/train/metrics/metric.py +49 -17
- mindspore/train/metrics/occlusion_sensitivity.py +4 -4
- mindspore/train/metrics/perplexity.py +1 -1
- mindspore/train/metrics/precision.py +2 -2
- mindspore/train/metrics/recall.py +2 -3
- mindspore/train/metrics/roc.py +7 -7
- mindspore/train/metrics/root_mean_square_surface_distance.py +5 -4
- mindspore/train/metrics/topk.py +7 -4
- mindspore/train/mind_ir_pb2.py +193 -48
- mindspore/train/model.py +377 -133
- mindspore/train/serialization.py +697 -245
- mindspore/train/summary/_summary_adapter.py +5 -2
- mindspore/train/summary/_writer_pool.py +4 -3
- mindspore/train/summary/summary_record.py +25 -23
- mindspore/train/train_thor/convert_utils.py +39 -23
- mindspore/train/train_thor/dataset_helper.py +4 -3
- mindspore/train/train_thor/model_thor.py +8 -8
- mindspore/version.py +1 -1
- {mindspore-2.0.0rc1.dist-info → mindspore-2.2.0.dist-info}/METADATA +7 -8
- {mindspore-2.0.0rc1.dist-info → mindspore-2.2.0.dist-info}/RECORD +633 -804
- {mindspore-2.0.0rc1.dist-info → mindspore-2.2.0.dist-info}/entry_points.txt +0 -1
- mindspore/_akg/akg/tvm/contrib/debugger/__init__.py +0 -16
- mindspore/_akg/akg/tvm/contrib/debugger/debug_result.py +0 -274
- mindspore/_akg/akg/tvm/contrib/debugger/debug_runtime.py +0 -259
- mindspore/_akg/akg/tvm/contrib/peak.py +0 -341
- mindspore/_akg/akg/tvm/contrib/rpc.py +0 -25
- mindspore/_akg/akg/tvm/contrib/xcode.py +0 -257
- mindspore/_akg/akg/tvm/exec/__init__.py +0 -17
- mindspore/_akg/akg/tvm/exec/autotvm_log_editor.py +0 -60
- mindspore/_akg/akg/tvm/exec/measure_peak.py +0 -48
- mindspore/_akg/akg/tvm/exec/query_rpc_tracker.py +0 -48
- mindspore/_akg/akg/tvm/exec/rpc_proxy.py +0 -98
- mindspore/_akg/akg/tvm/exec/rpc_server.py +0 -88
- mindspore/_akg/akg/tvm/exec/rpc_tracker.py +0 -62
- mindspore/_akg/akg/tvm/rpc/__init__.py +0 -29
- mindspore/_akg/akg/tvm/rpc/base.py +0 -182
- mindspore/_akg/akg/tvm/rpc/client.py +0 -436
- mindspore/_akg/akg/tvm/rpc/proxy.py +0 -595
- mindspore/_akg/akg/tvm/rpc/server.py +0 -413
- mindspore/_akg/akg/tvm/rpc/tornado_util.py +0 -121
- mindspore/_akg/akg/tvm/rpc/tracker.py +0 -431
- mindspore/_extends/graph_kernel/expander.py +0 -80
- mindspore/_extends/graph_kernel/expanders/__init__.py +0 -57
- mindspore/_extends/graph_kernel/expanders/_utils.py +0 -269
- mindspore/_extends/graph_kernel/expanders/addn.py +0 -33
- mindspore/_extends/graph_kernel/expanders/batchnorm.py +0 -152
- mindspore/_extends/graph_kernel/expanders/batchnorm_grad.py +0 -105
- mindspore/_extends/graph_kernel/expanders/bias_add_grad.py +0 -49
- mindspore/_extends/graph_kernel/expanders/clip_by_norm_no_div_sum.py +0 -33
- mindspore/_extends/graph_kernel/expanders/complex/abs.py +0 -30
- mindspore/_extends/graph_kernel/expanders/complex/add.py +0 -44
- mindspore/_extends/graph_kernel/expanders/complex/div.py +0 -62
- mindspore/_extends/graph_kernel/expanders/complex/mul.py +0 -52
- mindspore/_extends/graph_kernel/expanders/complex/real_div.py +0 -62
- mindspore/_extends/graph_kernel/expanders/complex/sub.py +0 -45
- mindspore/_extends/graph_kernel/expanders/conv2d.py +0 -200
- mindspore/_extends/graph_kernel/expanders/dropout_grad.py +0 -30
- mindspore/_extends/graph_kernel/expanders/equal_count.py +0 -50
- mindspore/_extends/graph_kernel/expanders/erfc.py +0 -35
- mindspore/_extends/graph_kernel/expanders/expand_dims.py +0 -50
- mindspore/_extends/graph_kernel/expanders/fused_adam.py +0 -44
- mindspore/_extends/graph_kernel/expanders/fused_adam_weight_decay.py +0 -47
- mindspore/_extends/graph_kernel/expanders/fused_mul_add.py +0 -28
- mindspore/_extends/graph_kernel/expanders/gather.py +0 -43
- mindspore/_extends/graph_kernel/expanders/gelu_grad.py +0 -70
- mindspore/_extends/graph_kernel/expanders/gkdropout.py +0 -40
- mindspore/_extends/graph_kernel/expanders/identity.py +0 -25
- mindspore/_extends/graph_kernel/expanders/layernorm.py +0 -93
- mindspore/_extends/graph_kernel/expanders/layernorm_grad.py +0 -113
- mindspore/_extends/graph_kernel/expanders/logsoftmax.py +0 -46
- mindspore/_extends/graph_kernel/expanders/logsoftmax_grad.py +0 -36
- mindspore/_extends/graph_kernel/expanders/matmul.py +0 -80
- mindspore/_extends/graph_kernel/expanders/maximum_grad.py +0 -59
- mindspore/_extends/graph_kernel/expanders/minimum_grad.py +0 -80
- mindspore/_extends/graph_kernel/expanders/oneslike.py +0 -26
- mindspore/_extends/graph_kernel/expanders/reduce_mean.py +0 -43
- mindspore/_extends/graph_kernel/expanders/relu_grad.py +0 -32
- mindspore/_extends/graph_kernel/expanders/sigmoid_cross_entropy_with_logits.py +0 -41
- mindspore/_extends/graph_kernel/expanders/sigmoid_cross_entropy_with_logits_grad.py +0 -35
- mindspore/_extends/graph_kernel/expanders/sigmoid_grad.py +0 -31
- mindspore/_extends/graph_kernel/expanders/slice.py +0 -35
- mindspore/_extends/graph_kernel/expanders/softmax_cross_entropy_with_logits.py +0 -42
- mindspore/_extends/graph_kernel/expanders/softmax_grad_ext.py +0 -41
- mindspore/_extends/graph_kernel/expanders/softsign.py +0 -28
- mindspore/_extends/graph_kernel/expanders/sqrt_grad.py +0 -29
- mindspore/_extends/graph_kernel/expanders/square_sum_all.py +0 -44
- mindspore/_extends/graph_kernel/expanders/square_sum_v1.py +0 -37
- mindspore/_extends/graph_kernel/expanders/squared_difference.py +0 -43
- mindspore/_extends/graph_kernel/expanders/tanh_grad.py +0 -31
- mindspore/_extends/graph_kernel/expanders/tile.py +0 -54
- mindspore/_extends/graph_kernel/model/op_infer.py +0 -506
- mindspore/_extends/parse/jit_fallback_modules.py +0 -51
- mindspore/dataset/datapreprocess/preprocess_imagenet_validate_dataset.py +0 -54
- mindspore/dataset/engine/graphdata.py +0 -1586
- mindspore/include/api/net.h +0 -142
- mindspore/ops/_grad/grad_array_ops.py +0 -1347
- mindspore/ops/_grad/grad_clip_ops.py +0 -84
- mindspore/ops/_grad/grad_debug_ops.py +0 -68
- mindspore/ops/_grad/grad_inner_ops.py +0 -235
- mindspore/ops/_grad/grad_math_ops.py +0 -1684
- mindspore/ops/_grad/grad_nn_ops.py +0 -1529
- mindspore/ops/_grad/grad_other_ops.py +0 -89
- mindspore/ops/_grad/grad_sequence_ops.py +0 -296
- mindspore/ops/_grad/grad_sparse.py +0 -323
- mindspore/ops/_grad_experimental/grad_image_ops.py +0 -249
- mindspore/ops/_grad_experimental/grad_linalg_ops.py +0 -195
- mindspore/ops/_grad_experimental/grad_scalar_ops.py +0 -112
- mindspore/ops/bprop_mindir/AdaptiveAvgPool2D_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/AdaptiveMaxPool2D_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/ApproximateEqual_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/Argmax_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/Argmin_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/AssignSub_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/Assign_bprop.mindir +0 -17
- mindspore/ops/bprop_mindir/AvgPool3D_bprop.mindir +0 -150
- mindspore/ops/bprop_mindir/AvgPool_bprop.mindir +0 -66
- mindspore/ops/bprop_mindir/BCEWithLogitsLoss_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/BNTrainingReduce_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/BatchNormGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/BatchToSpaceND_bprop.mindir +0 -28
- mindspore/ops/bprop_mindir/BiasAddGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/BinaryCrossEntropy_bprop.mindir +0 -33
- mindspore/ops/bprop_mindir/BroadcastTo_bprop.mindir +0 -306
- mindspore/ops/bprop_mindir/Broadcast_bprop.mindir +0 -13
- mindspore/ops/bprop_mindir/CTCLoss_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Concat_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Conv2DBackpropFilter_bprop.mindir +0 -240
- mindspore/ops/bprop_mindir/Conv2DBackpropInput_bprop.mindir +0 -247
- mindspore/ops/bprop_mindir/Conv2DTranspose_bprop.mindir +0 -247
- mindspore/ops/bprop_mindir/Conv3DTranspose_bprop.mindir +0 -315
- mindspore/ops/bprop_mindir/Conv3D_bprop.mindir +0 -278
- mindspore/ops/bprop_mindir/DType_bprop.mindir +0 -14
- mindspore/ops/bprop_mindir/DeformableOffsets_bprop.mindir +0 -58
- mindspore/ops/bprop_mindir/Depend_bprop.mindir +0 -13
- mindspore/ops/bprop_mindir/DepthToSpace_bprop.mindir +0 -23
- mindspore/ops/bprop_mindir/DepthwiseConv2dNative_bprop.mindir +0 -138
- mindspore/ops/bprop_mindir/DiagPart_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/Dropout2D_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Dropout3D_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/DropoutDoMask_bprop.mindir +0 -25
- mindspore/ops/bprop_mindir/DropoutGenMask_bprop.mindir +0 -18
- mindspore/ops/bprop_mindir/DropoutGrad_bprop.mindir +0 -27
- mindspore/ops/bprop_mindir/Dropout_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/DynamicGRUV2_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/DynamicRNN_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/DynamicShape_bprop.mindir +0 -14
- mindspore/ops/bprop_mindir/Elu_bprop.mindir +0 -16
- mindspore/ops/bprop_mindir/EmbeddingLookup_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Equal_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/ExpandDims_bprop.mindir +0 -58
- mindspore/ops/bprop_mindir/FastGeLU_bprop.mindir +0 -16
- mindspore/ops/bprop_mindir/Flatten_bprop.mindir +0 -54
- mindspore/ops/bprop_mindir/FloorDiv_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/GatherD_bprop.mindir +0 -26
- mindspore/ops/bprop_mindir/GatherNd_bprop.mindir +0 -57
- mindspore/ops/bprop_mindir/Gather_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/GreaterEqual_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/Greater_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/HSigmoid_bprop.mindir +0 -16
- mindspore/ops/bprop_mindir/HSwish_bprop.mindir +0 -16
- mindspore/ops/bprop_mindir/IOU_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/InstanceNorm_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/IsFinite_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/IsInf_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/IsNan_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/KLDivLoss_bprop.mindir +0 -126
- mindspore/ops/bprop_mindir/L2Loss_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/L2Normalize_bprop.mindir +0 -30
- mindspore/ops/bprop_mindir/LRN_bprop.mindir +0 -43
- mindspore/ops/bprop_mindir/LayerNormGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/LessEqual_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/Less_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/LinSpace_bprop.mindir +0 -23
- mindspore/ops/bprop_mindir/Load_bprop.mindir +0 -13
- mindspore/ops/bprop_mindir/LogSoftmax_bprop.mindir +0 -23
- mindspore/ops/bprop_mindir/LogicalAnd_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/LogicalNot_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/MaskedSelect_bprop.mindir +0 -21
- mindspore/ops/bprop_mindir/MaxPool3DGradGrad_bprop.mindir +0 -74
- mindspore/ops/bprop_mindir/MaxPool3DGrad_bprop.mindir +0 -74
- mindspore/ops/bprop_mindir/MaxPool3D_bprop.mindir +0 -75
- mindspore/ops/bprop_mindir/MaxPoolGradGrad_bprop.mindir +0 -65
- mindspore/ops/bprop_mindir/MaxPoolWithArgmax_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Maximum_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Minimum_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/MirrorPad_bprop.mindir +0 -27
- mindspore/ops/bprop_mindir/Mish_bprop.mindir +0 -35
- mindspore/ops/bprop_mindir/MulNoNan_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/NLLLoss_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/NonZero_bprop.mindir +0 -14
- mindspore/ops/bprop_mindir/NotEqual_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/OneHot_bprop.mindir +0 -26
- mindspore/ops/bprop_mindir/OnesLike_bprop.mindir +0 -14
- mindspore/ops/bprop_mindir/PReLU_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Pad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Padding_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/RNNTLoss_bprop.mindir +0 -29
- mindspore/ops/bprop_mindir/ROIAlign_bprop.mindir +0 -82
- mindspore/ops/bprop_mindir/Range_bprop.mindir +0 -22
- mindspore/ops/bprop_mindir/Rank_bprop.mindir +0 -14
- mindspore/ops/bprop_mindir/ReLU6_bprop.mindir +0 -16
- mindspore/ops/bprop_mindir/ReLUV2_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/ReduceAll_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/ReduceAny_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/ReluGrad_bprop.mindir +0 -20
- mindspore/ops/bprop_mindir/Reshape_bprop.mindir +0 -60
- mindspore/ops/bprop_mindir/ResizeBilinear_bprop.mindir +0 -29
- mindspore/ops/bprop_mindir/ResizeNearestNeighbor_bprop.mindir +0 -89
- mindspore/ops/bprop_mindir/ReverseSequence_bprop.mindir +0 -52
- mindspore/ops/bprop_mindir/ReverseV2_bprop.mindir +0 -22
- mindspore/ops/bprop_mindir/Round_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/ScatterMax_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/ScatterMin_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/ScatterNdUpdate_bprop.mindir +0 -22
- mindspore/ops/bprop_mindir/ScatterNd_bprop.mindir +0 -24
- mindspore/ops/bprop_mindir/ScatterNonAliasingAdd_bprop.mindir +0 -22
- mindspore/ops/bprop_mindir/ScatterUpdate_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/SeLU_bprop.mindir +0 -21
- mindspore/ops/bprop_mindir/Select_bprop.mindir +0 -31
- mindspore/ops/bprop_mindir/Shape_bprop.mindir +0 -14
- mindspore/ops/bprop_mindir/SigmoidCrossEntropyWithLogits_bprop.mindir +0 -21
- mindspore/ops/bprop_mindir/SigmoidGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Sigmoid_bprop.mindir +0 -16
- mindspore/ops/bprop_mindir/Sign_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/Slice_bprop.mindir +0 -26
- mindspore/ops/bprop_mindir/SmoothL1Loss_bprop.mindir +0 -36
- mindspore/ops/bprop_mindir/SoftmaxCrossEntropyWithLogits_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Softplus_bprop.mindir +0 -16
- mindspore/ops/bprop_mindir/Softsign_bprop.mindir +0 -33
- mindspore/ops/bprop_mindir/Sort_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/SpaceToBatchND_bprop.mindir +0 -28
- mindspore/ops/bprop_mindir/SpaceToDepth_bprop.mindir +0 -23
- mindspore/ops/bprop_mindir/SparseGatherV2_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/SparseSoftmaxCrossEntropyWithLogits_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Split_bprop.mindir +0 -22
- mindspore/ops/bprop_mindir/Squeeze_bprop.mindir +0 -54
- mindspore/ops/bprop_mindir/StridedSliceGrad_bprop.mindir +0 -95
- mindspore/ops/bprop_mindir/StridedSlice_bprop.mindir +0 -98
- mindspore/ops/bprop_mindir/Switch_bprop.mindir +0 -29
- mindspore/ops/bprop_mindir/TanhGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Tanh_bprop.mindir +0 -66
- mindspore/ops/bprop_mindir/TensorScatterAdd_bprop.mindir +0 -22
- mindspore/ops/bprop_mindir/TensorScatterUpdate_bprop.mindir +0 -29
- mindspore/ops/bprop_mindir/TensorShape_bprop.mindir +0 -14
- mindspore/ops/bprop_mindir/Tile_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/TopK_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/TransShape_bprop.mindir +0 -23
- mindspore/ops/bprop_mindir/TruncateDiv_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/TupleGetItem_bprop.mindir +0 -20
- mindspore/ops/bprop_mindir/Unique_bprop.mindir +0 -16
- mindspore/ops/bprop_mindir/Unstack_bprop.mindir +0 -22
- mindspore/ops/bprop_mindir/UpsampleNearest3D_bprop.mindir +0 -32
- mindspore/ops/bprop_mindir/UpsampleTrilinear3D_bprop.mindir +0 -38
- mindspore/ops/bprop_mindir/ZerosLike_bprop.mindir +0 -15
- mindspore/ops/bprop_mindir/generate_mindir.py +0 -114
- mindspore/rewrite/node_visitor.py +0 -44
- mindspore/rewrite/topological_manager.py +0 -203
- mindspore/scipy/sparse/linalg.py +0 -192
- {mindspore-2.0.0rc1.dist-info → mindspore-2.2.0.dist-info}/WHEEL +0 -0
- {mindspore-2.0.0rc1.dist-info → mindspore-2.2.0.dist-info}/top_level.txt +0 -0
mindspore/numpy/math_ops.py
CHANGED
|
@@ -22,6 +22,7 @@ import itertools
|
|
|
22
22
|
import sys
|
|
23
23
|
from numpy import dtype as nptype
|
|
24
24
|
|
|
25
|
+
import mindspore.ops as ops
|
|
25
26
|
from mindspore.ops import operations as P
|
|
26
27
|
from mindspore.ops import functional as F
|
|
27
28
|
from mindspore.ops import composite as C
|
|
@@ -82,7 +83,7 @@ def absolute(x, dtype=None):
|
|
|
82
83
|
|
|
83
84
|
Args:
|
|
84
85
|
x (Tensor): Tensor to be used for calculation.
|
|
85
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
86
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
86
87
|
output Tensor.
|
|
87
88
|
|
|
88
89
|
Returns:
|
|
@@ -121,10 +122,10 @@ def count_nonzero(x, axis=None, keepdims=False):
|
|
|
121
122
|
x (Tensor): The tensor for which to count non-zeros.
|
|
122
123
|
axis (Union[int,tuple], optional): Axis or tuple of axes along which to
|
|
123
124
|
count non-zeros. Default is None, meaning that non-zeros will be counted
|
|
124
|
-
along a flattened version of `x`. Default:
|
|
125
|
+
along a flattened version of `x`. Default: ``None`` .
|
|
125
126
|
keepdims (bool, optional): If this is set to True, the axes that are counted
|
|
126
127
|
are left in the result as dimensions with size one. With this option,
|
|
127
|
-
the result will broadcast correctly against `x`. Default:
|
|
128
|
+
the result will broadcast correctly against `x`. Default: ``False`` .
|
|
128
129
|
|
|
129
130
|
Returns:
|
|
130
131
|
Tensor, indicating number of non-zero values in the `x` along a given axis.
|
|
@@ -148,7 +149,7 @@ def count_nonzero(x, axis=None, keepdims=False):
|
|
|
148
149
|
return ZERO_TENSOR
|
|
149
150
|
if axis is None:
|
|
150
151
|
axis = ()
|
|
151
|
-
return
|
|
152
|
+
return ops.count_nonzero(x=x, axis=axis, keep_dims=keepdims)
|
|
152
153
|
|
|
153
154
|
|
|
154
155
|
def clip(x, xmin, xmax, dtype=None):
|
|
@@ -167,7 +168,7 @@ def clip(x, xmin, xmax, dtype=None):
|
|
|
167
168
|
on upper interval edge. Not more than one of `xmin` and `xmax` may be None.
|
|
168
169
|
If `xmin` or `xmax` are tensors, then the three tensors will be broadcasted
|
|
169
170
|
to match their shapes.
|
|
170
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
171
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
171
172
|
output Tensor.
|
|
172
173
|
|
|
173
174
|
Returns:
|
|
@@ -203,7 +204,7 @@ def deg2rad(x, dtype=None):
|
|
|
203
204
|
|
|
204
205
|
Args:
|
|
205
206
|
x (Tensor): Angles in degrees.
|
|
206
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
207
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
207
208
|
output Tensor.
|
|
208
209
|
|
|
209
210
|
Returns:
|
|
@@ -236,7 +237,7 @@ def rad2deg(x, dtype=None):
|
|
|
236
237
|
|
|
237
238
|
Args:
|
|
238
239
|
x (Tensor): Angles in radians.
|
|
239
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
240
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
240
241
|
output Tensor.
|
|
241
242
|
|
|
242
243
|
Returns:
|
|
@@ -271,7 +272,7 @@ def add(x1, x2, dtype=None):
|
|
|
271
272
|
Args:
|
|
272
273
|
x1 (Tensor): input to be added.
|
|
273
274
|
x2 (Tensor): input to be added.
|
|
274
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
275
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
275
276
|
output Tensor.
|
|
276
277
|
|
|
277
278
|
Returns:
|
|
@@ -309,7 +310,7 @@ def subtract(x1, x2, dtype=None):
|
|
|
309
310
|
Args:
|
|
310
311
|
x1 (Tensor): The input to be subtracted from.
|
|
311
312
|
x2 (Tensor): The input to be subtracted by.
|
|
312
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
313
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
313
314
|
output Tensor.
|
|
314
315
|
|
|
315
316
|
Returns:
|
|
@@ -343,7 +344,7 @@ def multiply(x1, x2, dtype=None):
|
|
|
343
344
|
Args:
|
|
344
345
|
x1 (Tensor): input tensor to be multiplied.
|
|
345
346
|
x2 (Tensor): input tensor to be multiplied.
|
|
346
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
347
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
347
348
|
output Tensor.
|
|
348
349
|
|
|
349
350
|
Returns:
|
|
@@ -387,7 +388,7 @@ def divide(x1, x2, dtype=None):
|
|
|
387
388
|
Args:
|
|
388
389
|
x1 (Tensor): the divident.
|
|
389
390
|
x2 (Tensor): the divisor.
|
|
390
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
391
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
391
392
|
output Tensor.
|
|
392
393
|
|
|
393
394
|
Returns:
|
|
@@ -427,7 +428,7 @@ def true_divide(x1, x2, dtype=None):
|
|
|
427
428
|
Args:
|
|
428
429
|
x1 (Tensor): the dividend.
|
|
429
430
|
x2 (Tensor): the divisor.
|
|
430
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
431
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
431
432
|
output Tensor.
|
|
432
433
|
|
|
433
434
|
Returns:
|
|
@@ -463,7 +464,7 @@ def power(x1, x2, dtype=None):
|
|
|
463
464
|
Args:
|
|
464
465
|
x1 (Tensor): The bases.
|
|
465
466
|
x2 (Tensor): The exponents.
|
|
466
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
467
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
467
468
|
output Tensor.
|
|
468
469
|
|
|
469
470
|
Returns:
|
|
@@ -505,7 +506,7 @@ def float_power(x1, x2, dtype=None):
|
|
|
505
506
|
Args:
|
|
506
507
|
x1 (Tensor): the bases.
|
|
507
508
|
x2 (Tensor): the exponents.
|
|
508
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
509
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
509
510
|
output Tensor.
|
|
510
511
|
|
|
511
512
|
Returns:
|
|
@@ -545,7 +546,7 @@ def minimum(x1, x2, dtype=None):
|
|
|
545
546
|
Args:
|
|
546
547
|
x1 (Tensor): first input tensor to be compared.
|
|
547
548
|
x2 (Tensor): second input tensor to be compared.
|
|
548
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
549
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
549
550
|
output Tensor.
|
|
550
551
|
|
|
551
552
|
Returns:
|
|
@@ -605,13 +606,13 @@ def mean(a, axis=None, keepdims=False, dtype=None):
|
|
|
605
606
|
If a is not an array, a conversion is attempted.
|
|
606
607
|
axis (None or int or tuple of integers, optional): Axis or axes along
|
|
607
608
|
which the means are computed. The default is to compute
|
|
608
|
-
the mean
|
|
609
|
+
the mean of the flattened array. If this is a tuple of
|
|
609
610
|
ints, a mean is performed over multiple axes.
|
|
610
|
-
keepdims (bool, optional): If this is set to True, the axes which
|
|
611
|
+
keepdims (bool, optional): If this is set to ``True`` , the axes which
|
|
611
612
|
are reduced are left in the result as dimensions with
|
|
612
613
|
size one. With this option, the result will broadcast
|
|
613
614
|
correctly against the input tensor.
|
|
614
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
615
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
615
616
|
output Tensor.
|
|
616
617
|
|
|
617
618
|
Returns:
|
|
@@ -740,6 +741,10 @@ def dot(a, b):
|
|
|
740
741
|
[[[105. 105. 105. 105.]
|
|
741
742
|
[105. 105. 105. 105.]]]
|
|
742
743
|
"""
|
|
744
|
+
def _check(dim_a, dim_b):
|
|
745
|
+
if dim_a != dim_b:
|
|
746
|
+
raise ValueError('shapes are not aligned')
|
|
747
|
+
|
|
743
748
|
ndim_a, ndim_b = F.rank(a), F.rank(b)
|
|
744
749
|
if ndim_a == 0 or ndim_b == 0:
|
|
745
750
|
return F.tensor_mul(a, b)
|
|
@@ -748,8 +753,7 @@ def dot(a, b):
|
|
|
748
753
|
perm = perm[:-2] + (perm[-1],) + (perm[-2],)
|
|
749
754
|
b = F.transpose(b, perm)
|
|
750
755
|
|
|
751
|
-
|
|
752
|
-
_raise_value_error('shapes are not aligned')
|
|
756
|
+
_check(F.shape(a)[-1], F.shape(b)[-1])
|
|
753
757
|
a_aligned = F.reshape(a, (-1, F.shape(a)[-1]))
|
|
754
758
|
b_aligned = F.reshape(b, (-1, F.shape(b)[-1]))
|
|
755
759
|
|
|
@@ -876,7 +880,7 @@ def tensordot(a, b, axes=2):
|
|
|
876
880
|
"""
|
|
877
881
|
if F.rank(a)*F.rank(b) == 0 and axes == 0:
|
|
878
882
|
return F.tensor_mul(a, b)
|
|
879
|
-
return
|
|
883
|
+
return ops.tensor_dot(a, b, axes)
|
|
880
884
|
|
|
881
885
|
|
|
882
886
|
def std(x, axis=None, ddof=0, keepdims=False):
|
|
@@ -894,16 +898,16 @@ def std(x, axis=None, ddof=0, keepdims=False):
|
|
|
894
898
|
Args:
|
|
895
899
|
x (Tensor): A Tensor to be calculated.
|
|
896
900
|
axis (Union[None, int, tuple(int)]): Axis or axes along which the standard
|
|
897
|
-
deviation is computed. Default:
|
|
901
|
+
deviation is computed. Default: ``None`` .
|
|
898
902
|
|
|
899
|
-
If
|
|
903
|
+
If ``None`` , compute the standard deviation of the flattened array.
|
|
900
904
|
ddof (int): Means Delta Degrees of Freedom. The divisor used in calculations is :math:`N - ddof`,
|
|
901
905
|
where :math:`N` represents the number of elements. Default: 0.
|
|
902
906
|
keepdims: If this is set to True, the axes which are reduced are left in the result as
|
|
903
907
|
dimensions with size one. With this option, the result will broadcast correctly against the input tensor.
|
|
904
908
|
If the default value is passed, then keepdims will not be passed through to the std method of
|
|
905
909
|
sub-classes of tensor, however any non-default value will be. If the sub-class’ method does not
|
|
906
|
-
implement keepdims any exceptions will be raised. Default:
|
|
910
|
+
implement keepdims any exceptions will be raised. Default: ``False`` .
|
|
907
911
|
|
|
908
912
|
Returns:
|
|
909
913
|
Standard deviation tensor.
|
|
@@ -937,14 +941,14 @@ def var(x, axis=None, ddof=0, keepdims=False):
|
|
|
937
941
|
Args:
|
|
938
942
|
x (Tensor): A Tensor to be calculated.
|
|
939
943
|
axis (Union[None, int, tuple(int)]): Axis or axes along which the variance is computed.
|
|
940
|
-
The default is to compute the variance of the flattened array. Default:
|
|
941
|
-
ddof (int): Means Delta Degrees of Freedom. Default: 0.
|
|
944
|
+
The default is to compute the variance of the flattened array. Default: ``None`` .
|
|
945
|
+
ddof (int): Means Delta Degrees of Freedom. Default: ``0`` .
|
|
942
946
|
The divisor used in calculations is :math:`N - ddof`, where :math:`N` represents the number of elements.
|
|
943
947
|
keepdims (bool): If this is set to True, the axes which are reduced are left in the result as
|
|
944
948
|
dimensions with size one. With this option, the result will broadcast correctly against the input tensor.
|
|
945
949
|
If the default value is passed, then keepdims will not be passed through to the var method of
|
|
946
950
|
sub-classes of tensor, however any non-default value will be. If the sub-class method does not
|
|
947
|
-
implement keepdims any exceptions will be raised. Default:
|
|
951
|
+
implement keepdims any exceptions will be raised. Default: ``False`` .
|
|
948
952
|
|
|
949
953
|
Supported Platforms:
|
|
950
954
|
``Ascend`` ``GPU`` ``CPU``
|
|
@@ -974,11 +978,11 @@ def ptp(x, axis=None, keepdims=False):
|
|
|
974
978
|
Args:
|
|
975
979
|
x (Tensor): Input tensor.
|
|
976
980
|
axis (Union[None, int, tuple(int)]): Axis or axes along which the range is computed.
|
|
977
|
-
The default is to compute the variance of the flattened array. Default: None
|
|
981
|
+
The default is to compute the variance of the flattened array. Default: ``None``.
|
|
978
982
|
keepdims (bool): If this is set to True, the axes which are reduced are left in the result as
|
|
979
983
|
dimensions with size one. With this option, the result will broadcast correctly against the input tensor.
|
|
980
984
|
If the default value is passed, then keepdims will not be passed through to the ptp method of
|
|
981
|
-
sub-classes of tensor, however any non-default value will be. Default
|
|
985
|
+
sub-classes of tensor, however any non-default value will be. Default: ``False`` .
|
|
982
986
|
|
|
983
987
|
Returns:
|
|
984
988
|
Tensor.
|
|
@@ -1007,14 +1011,14 @@ def average(x, axis=None, weights=None, returned=False):
|
|
|
1007
1011
|
|
|
1008
1012
|
Args:
|
|
1009
1013
|
x (Tensor): A Tensor to be averaged.
|
|
1010
|
-
axis (Union[None, int, tuple(int)]): Axis along which to average `x`. Default:
|
|
1014
|
+
axis (Union[None, int, tuple(int)]): Axis along which to average `x`. Default: ``None`` .
|
|
1011
1015
|
If the axis is `None`, it will average over all of the elements of the tensor `x`.
|
|
1012
1016
|
If the axis is negative, it counts from the last to the first axis.
|
|
1013
|
-
weights (Union[None, Tensor]): Weights associated with the values in `x`. Default:
|
|
1017
|
+
weights (Union[None, Tensor]): Weights associated with the values in `x`. Default: ``None`` .
|
|
1014
1018
|
If `weights` is `None`, all the data in `x` are assumed to have a weight equal to one.
|
|
1015
1019
|
If `weights` is 1-D tensor, the length must be the same as the given axis.
|
|
1016
1020
|
Otherwise, `weights` should have the same shape as `x`.
|
|
1017
|
-
returned (bool): Default:
|
|
1021
|
+
returned (bool): Default: ``False`` .
|
|
1018
1022
|
If `True`, the tuple (average, sum_of_weights) is returned.
|
|
1019
1023
|
If `False`, only the average is returned.
|
|
1020
1024
|
|
|
@@ -1104,7 +1108,7 @@ def matmul(x1, x2, dtype=None):
|
|
|
1104
1108
|
Args:
|
|
1105
1109
|
x1 (Tensor): Input tensor, scalar not allowed.
|
|
1106
1110
|
x2 (Tensor): Input tensor, scalar not allowed.
|
|
1107
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1111
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1108
1112
|
output Tensor.
|
|
1109
1113
|
|
|
1110
1114
|
Returns:
|
|
@@ -1145,7 +1149,7 @@ def square(x, dtype=None):
|
|
|
1145
1149
|
|
|
1146
1150
|
Args:
|
|
1147
1151
|
x (Tensor): Input data.
|
|
1148
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1152
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1149
1153
|
output Tensor.
|
|
1150
1154
|
|
|
1151
1155
|
Returns:
|
|
@@ -1176,7 +1180,7 @@ def sqrt(x, dtype=None):
|
|
|
1176
1180
|
|
|
1177
1181
|
Args:
|
|
1178
1182
|
x (Tensor): The values whose square-roots are required.
|
|
1179
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1183
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1180
1184
|
output Tensor.
|
|
1181
1185
|
|
|
1182
1186
|
Returns:
|
|
@@ -1216,7 +1220,7 @@ def reciprocal(x, dtype=None):
|
|
|
1216
1220
|
x (Tensor): Input array. For integer arguments with absolute value larger
|
|
1217
1221
|
than 1 the result is always zero because of the way Python handles
|
|
1218
1222
|
integer division. For integer zero the result is an overflow.
|
|
1219
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1223
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1220
1224
|
output Tensor.
|
|
1221
1225
|
|
|
1222
1226
|
Returns:
|
|
@@ -1251,7 +1255,7 @@ def log(x, dtype=None):
|
|
|
1251
1255
|
|
|
1252
1256
|
Args:
|
|
1253
1257
|
x (Tensor): Input array.
|
|
1254
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1258
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1255
1259
|
output Tensor.
|
|
1256
1260
|
|
|
1257
1261
|
Returns:
|
|
@@ -1295,7 +1299,7 @@ def maximum(x1, x2, dtype=None):
|
|
|
1295
1299
|
x2 (Tensor): The array holding the elements to be compared. If
|
|
1296
1300
|
``x1.shape != x2.shape``, they must be broadcastable to a common shape
|
|
1297
1301
|
(which becomes the shape of the output).
|
|
1298
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1302
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1299
1303
|
output Tensor.
|
|
1300
1304
|
|
|
1301
1305
|
Returns:
|
|
@@ -1345,7 +1349,7 @@ def heaviside(x1, x2, dtype=None):
|
|
|
1345
1349
|
x2 (Tensor): The value of the function when `x1` is 0. If
|
|
1346
1350
|
``x1.shape != x2.shape``, they must be broadcastable to a common shape
|
|
1347
1351
|
(which becomes the shape of the output).
|
|
1348
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1352
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1349
1353
|
output Tensor.
|
|
1350
1354
|
|
|
1351
1355
|
Returns:
|
|
@@ -1398,18 +1402,18 @@ def amax(a, axis=None, keepdims=False, initial=None, where=True):
|
|
|
1398
1402
|
|
|
1399
1403
|
Args:
|
|
1400
1404
|
a (Tensor): Input data.
|
|
1401
|
-
axis (None or int or tuple of integers, optional):
|
|
1405
|
+
axis (None or int or tuple of integers, optional): Default: ``None`` . Axis or
|
|
1402
1406
|
axes along which to operate. By default, flattened input is used. If
|
|
1403
1407
|
this is a tuple of integers, the maximum is selected over multiple axes,
|
|
1404
1408
|
instead of a single axis or all the axes as before.
|
|
1405
|
-
keepdims (boolean, optional):
|
|
1409
|
+
keepdims (boolean, optional): Default: ``False`` .
|
|
1406
1410
|
If this is set to True, the axes which are reduced are left in the
|
|
1407
1411
|
result as dimensions with size one. With this option, the result will
|
|
1408
1412
|
broadcast correctly against the input array.
|
|
1409
|
-
initial (scalar, optional):
|
|
1413
|
+
initial (scalar, optional): Default: ``None`` .
|
|
1410
1414
|
The minimum value of an output element. Must be present to allow
|
|
1411
1415
|
computation on empty slice.
|
|
1412
|
-
where (boolean Tensor, optional):
|
|
1416
|
+
where (boolean Tensor, optional): Default: ``True`` .
|
|
1413
1417
|
A boolean array which is broadcasted to match the dimensions of array,
|
|
1414
1418
|
and selects elements to include in the reduction. If non-default value
|
|
1415
1419
|
is passed, initial must also be provided.
|
|
@@ -1454,18 +1458,18 @@ def amin(a, axis=None, keepdims=False, initial=None, where=True):
|
|
|
1454
1458
|
|
|
1455
1459
|
Args:
|
|
1456
1460
|
a (Tensor): Input data.
|
|
1457
|
-
axis (None or int or tuple of integers, optional):
|
|
1461
|
+
axis (None or int or tuple of integers, optional): Default: ``None`` . Axis or
|
|
1458
1462
|
axes along which to operate. By default, flattened input is used. If
|
|
1459
1463
|
this is a tuple of integers, the minimum is selected over multiple axes,
|
|
1460
1464
|
instead of a single axis or all the axes as before.
|
|
1461
|
-
keepdims (bool, optional):
|
|
1465
|
+
keepdims (bool, optional): Default: ``False`` .
|
|
1462
1466
|
If this is set to True, the axes which are reduced are left in the
|
|
1463
1467
|
result as dimensions with size one. With this option, the result will
|
|
1464
1468
|
broadcast correctly against the input array.
|
|
1465
|
-
initial (Number, optional):
|
|
1469
|
+
initial (Number, optional): Default: ``None`` .
|
|
1466
1470
|
The maximum value of an output element. Must be present to allow
|
|
1467
1471
|
computation on empty slice.
|
|
1468
|
-
where (bool Tensor, optional):
|
|
1472
|
+
where (bool Tensor, optional): Default: ``True`` .
|
|
1469
1473
|
A boolean array which is broadcasted to match the dimensions of array,
|
|
1470
1474
|
and selects elements to include in the reduction. If non-default value
|
|
1471
1475
|
is passed, initial must also be provided.
|
|
@@ -1519,7 +1523,7 @@ def hypot(x1, x2, dtype=None):
|
|
|
1519
1523
|
x2 (Tensor): Leg of the triangle(s). If ``x1.shape != x2.shape``, they
|
|
1520
1524
|
must be broadcastable to a common shape (which becomes the shape of
|
|
1521
1525
|
the output).
|
|
1522
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1526
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1523
1527
|
output Tensor.
|
|
1524
1528
|
|
|
1525
1529
|
Returns:
|
|
@@ -1568,7 +1572,7 @@ def floor(x, dtype=None):
|
|
|
1568
1572
|
|
|
1569
1573
|
Args:
|
|
1570
1574
|
x (Tensor): input data.
|
|
1571
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1575
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1572
1576
|
output Tensor.
|
|
1573
1577
|
|
|
1574
1578
|
Returns:
|
|
@@ -1600,7 +1604,7 @@ def floor_divide(x1, x2, dtype=None):
|
|
|
1600
1604
|
Args:
|
|
1601
1605
|
x1 (Tensor): Input array.
|
|
1602
1606
|
x2 (Tensor): Input array.
|
|
1603
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1607
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1604
1608
|
output Tensor.
|
|
1605
1609
|
|
|
1606
1610
|
Returns:
|
|
@@ -1657,7 +1661,7 @@ def remainder(x1, x2, dtype=None):
|
|
|
1657
1661
|
Args:
|
|
1658
1662
|
x1 (Tensor): input array.
|
|
1659
1663
|
x2 (Tensor): input array.
|
|
1660
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1664
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1661
1665
|
output Tensor.
|
|
1662
1666
|
|
|
1663
1667
|
Returns:
|
|
@@ -1732,7 +1736,7 @@ def fmod(x1, x2, dtype=None):
|
|
|
1732
1736
|
Args:
|
|
1733
1737
|
x1 (Tensor): the first input arrays.
|
|
1734
1738
|
x2 (Tensor): the second input arrays.
|
|
1735
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1739
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1736
1740
|
output Tensor.
|
|
1737
1741
|
|
|
1738
1742
|
Returns:
|
|
@@ -1764,7 +1768,7 @@ def trunc(x, dtype=None):
|
|
|
1764
1768
|
|
|
1765
1769
|
Args:
|
|
1766
1770
|
x (Tensor): input data.
|
|
1767
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1771
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1768
1772
|
output Tensor.
|
|
1769
1773
|
|
|
1770
1774
|
Returns:
|
|
@@ -1798,7 +1802,7 @@ def exp(x, dtype=None):
|
|
|
1798
1802
|
|
|
1799
1803
|
Args:
|
|
1800
1804
|
x (Tensor): input data.
|
|
1801
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1805
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1802
1806
|
output Tensor.
|
|
1803
1807
|
|
|
1804
1808
|
Returns:
|
|
@@ -1829,7 +1833,7 @@ def expm1(x, dtype=None):
|
|
|
1829
1833
|
|
|
1830
1834
|
Args:
|
|
1831
1835
|
x (Tensor): input data.
|
|
1832
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1836
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1833
1837
|
output Tensor.
|
|
1834
1838
|
|
|
1835
1839
|
Returns:
|
|
@@ -1856,7 +1860,7 @@ def divmod_(x1, x2, dtype=None):
|
|
|
1856
1860
|
x1(Union[Tensor]): Dividend tensor.
|
|
1857
1861
|
x2(Union[Tensor, int, float, bool]): Divisor. If ``x1.shape != x2.shape``,
|
|
1858
1862
|
they must be broadcastable to a common shape.
|
|
1859
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
1863
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
1860
1864
|
output Tensor.
|
|
1861
1865
|
|
|
1862
1866
|
Returns:
|
|
@@ -1912,14 +1916,14 @@ def diff(a, n=1, axis=-1, prepend=None, append=None):
|
|
|
1912
1916
|
Args:
|
|
1913
1917
|
a (Tensor): Input tensor.
|
|
1914
1918
|
n (int, optional): The number of times values are differenced. If zero,
|
|
1915
|
-
the input is returned as-is. Default: 1.
|
|
1919
|
+
the input is returned as-is. Default: ``1`` .
|
|
1916
1920
|
axis (int, optional): The axis along which the difference is taken, default
|
|
1917
|
-
is the last axis. Default:
|
|
1921
|
+
is the last axis. Default: ``-1`` .
|
|
1918
1922
|
prepend/append (Tensor, optional): Values to prepend or append to a along
|
|
1919
1923
|
`axis` prior to performing the difference. Scalar values are expanded to
|
|
1920
1924
|
arrays with length 1 in the direction of `axis` and the shape of the input
|
|
1921
1925
|
array in along all other axes. Otherwise the dimension and shape must
|
|
1922
|
-
match `a` except along axis. Default:
|
|
1926
|
+
match `a` except along axis. Default: ``None`` .
|
|
1923
1927
|
|
|
1924
1928
|
Returns:
|
|
1925
1929
|
The n-th differences. The shape of the output is the same as a except along
|
|
@@ -2042,10 +2046,9 @@ def trapz(y, x=None, dx=1.0, axis=-1):
|
|
|
2042
2046
|
y (Tensor): Input array to integrate.
|
|
2043
2047
|
x (Union[int, float, bool, list, tuple, Tensor], optional): The sample points
|
|
2044
2048
|
corresponding to the `y` values. If `x` is None, the sample points are
|
|
2045
|
-
assumed to be evenly spaced `dx` apart.
|
|
2046
|
-
dx (scalar, optional): The spacing between sample points when `x` is None.
|
|
2047
|
-
|
|
2048
|
-
axis (int, optional): The axis along which to integrate. Defaults to -1.
|
|
2049
|
+
assumed to be evenly spaced `dx` apart. Default: ``None`` .
|
|
2050
|
+
dx (scalar, optional): The spacing between sample points when `x` is None. Default: ``1.0`` .
|
|
2051
|
+
axis (int, optional): The axis along which to integrate. Default: ``-1`` .
|
|
2049
2052
|
|
|
2050
2053
|
Returns:
|
|
2051
2054
|
Tensor of float, definite integral as approximated by trapezoidal rule.
|
|
@@ -2131,7 +2134,7 @@ def gcd(x1, x2, dtype=None):
|
|
|
2131
2134
|
Args:
|
|
2132
2135
|
x1 (Tensor): input data.
|
|
2133
2136
|
x2 (Tensor): input data.
|
|
2134
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
2137
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
2135
2138
|
output Tensor.
|
|
2136
2139
|
|
|
2137
2140
|
Returns:
|
|
@@ -2161,7 +2164,7 @@ def lcm(x1, x2, dtype=None):
|
|
|
2161
2164
|
Args:
|
|
2162
2165
|
x1 (Tensor): input data.
|
|
2163
2166
|
x2 (Tensor): input data.
|
|
2164
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
2167
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
2165
2168
|
output Tensor.
|
|
2166
2169
|
|
|
2167
2170
|
Returns:
|
|
@@ -2303,7 +2306,7 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=N
|
|
|
2303
2306
|
Estimates a covariance matrix, given data and weights.
|
|
2304
2307
|
|
|
2305
2308
|
Covariance indicates the level to which two variables vary together. If we examine
|
|
2306
|
-
N-dimensional samples, :math:`X = [x_1, x_2,
|
|
2309
|
+
N-dimensional samples, :math:`X = [x_1, x_2, .. x_N]^T`, then the covariance matrix
|
|
2307
2310
|
element :math:`C_{ij}` is the covariance of :math:`x_i` and :math:`x_j`. The element
|
|
2308
2311
|
:math:`C_{ii}` is the variance of :math:`x_i`.
|
|
2309
2312
|
|
|
@@ -2417,7 +2420,7 @@ def _shape_reduced_keepdims(shape, axes):
|
|
|
2417
2420
|
keeping the number of dimensions unchanged.
|
|
2418
2421
|
"""
|
|
2419
2422
|
ndim_out = F.tuple_len(shape)
|
|
2420
|
-
shape_out = [1]*ndim_out
|
|
2423
|
+
shape_out = [1] * ndim_out
|
|
2421
2424
|
for i in range(ndim_out):
|
|
2422
2425
|
if i not in axes:
|
|
2423
2426
|
shape_out[i] = shape[i]
|
|
@@ -2498,9 +2501,9 @@ def nanmax(a, axis=None, dtype=None, keepdims=False):
|
|
|
2498
2501
|
is desired. If `a` is not an array, a conversion is attempted.
|
|
2499
2502
|
axis (Union[int, tuple of int, None], optional): Axis or axes along which the maximum is
|
|
2500
2503
|
computed. The default is to compute the maximum of the flattened array.
|
|
2501
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
2504
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
2502
2505
|
output Tensor.
|
|
2503
|
-
keepdims (boolean, optional):
|
|
2506
|
+
keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
|
|
2504
2507
|
are reduced are left in the result as dimensions with size one. With this option,
|
|
2505
2508
|
the result will broadcast correctly against the original `a`.
|
|
2506
2509
|
|
|
@@ -2548,9 +2551,9 @@ def nanmin(a, axis=None, dtype=None, keepdims=False):
|
|
|
2548
2551
|
is desired. If `a` is not an array, a conversion is attempted.
|
|
2549
2552
|
axis (Union[int, tuple of int, None], optional): Axis or axes along which the minimum is
|
|
2550
2553
|
computed. The default is to compute the minimum of the flattened array.
|
|
2551
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
2554
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
2552
2555
|
output Tensor.
|
|
2553
|
-
keepdims (boolean, optional):
|
|
2556
|
+
keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
|
|
2554
2557
|
are reduced are left in the result as dimensions with size one. With this option,
|
|
2555
2558
|
the result will broadcast correctly against the original `a`.
|
|
2556
2559
|
|
|
@@ -2603,9 +2606,9 @@ def nansum(a, axis=None, dtype=None, keepdims=False):
|
|
|
2603
2606
|
whose sum is desired. If `a` is not an array, a conversion is attempted.
|
|
2604
2607
|
axis (Union[int, tuple of int, None], optional): Axis or axes along which the sum is
|
|
2605
2608
|
computed. The default is to compute the sum of the flattened array.
|
|
2606
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
2609
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
2607
2610
|
output Tensor.
|
|
2608
|
-
keepdims (boolean, optional):
|
|
2611
|
+
keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
|
|
2609
2612
|
are reduced are left in the result as dimensions with size one. With this option,
|
|
2610
2613
|
the result will broadcast correctly against the original `a`.
|
|
2611
2614
|
|
|
@@ -2660,9 +2663,9 @@ def nanmean(a, axis=None, dtype=None, keepdims=False):
|
|
|
2660
2663
|
whose mean is desired. If `a` is not an array, a conversion is attempted.
|
|
2661
2664
|
axis (Union[int, tuple of int, None], optional): Axis or axes along which the mean is
|
|
2662
2665
|
computed. The default is to compute the mean of the flattened array.
|
|
2663
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
2666
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
2664
2667
|
output Tensor.
|
|
2665
|
-
keepdims (boolean, optional):
|
|
2668
|
+
keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
|
|
2666
2669
|
are reduced are left in the result as dimensions with size one. With this option,
|
|
2667
2670
|
the result will broadcast correctly against the original `a`.
|
|
2668
2671
|
|
|
@@ -2722,12 +2725,12 @@ def nanvar(a, axis=None, dtype=None, ddof=0, keepdims=False):
|
|
|
2722
2725
|
whose variance is desired. If `a` is not an array, a conversion is attempted.
|
|
2723
2726
|
axis (Union[int, tuple of int, None], optional): Axis or axes along which the variance is
|
|
2724
2727
|
computed. The default is to compute the variance of the flattened array.
|
|
2725
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
2728
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
2726
2729
|
output Tensor.
|
|
2727
2730
|
ddof (int, optional): "Delta Degrees of Freedom": the divisor used in the calculation is
|
|
2728
2731
|
``N - ddof``, where `N` represents the number of non-NaN elements. By default `ddof`
|
|
2729
2732
|
is zero.
|
|
2730
|
-
keepdims (boolean, optional):
|
|
2733
|
+
keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
|
|
2731
2734
|
are reduced are left in the result as dimensions with size one. With this option,
|
|
2732
2735
|
the result will broadcast correctly against the original `a`.
|
|
2733
2736
|
|
|
@@ -2777,12 +2780,12 @@ def nanstd(a, axis=None, dtype=None, ddof=0, keepdims=False):
|
|
|
2777
2780
|
axis (Union[int, tuple of int, None], optional): Axis or axes along which the standard
|
|
2778
2781
|
deviation is computed. The default is to compute the standard deviation of the
|
|
2779
2782
|
flattened array.
|
|
2780
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
2783
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
2781
2784
|
output Tensor.
|
|
2782
2785
|
ddof (int, optional): "Delta Degrees of Freedom": the divisor used in the calculation is
|
|
2783
2786
|
``N - ddof``, where `N` represents the number of non-NaN elements. By default `ddof`
|
|
2784
2787
|
is zero.
|
|
2785
|
-
keepdims (boolean, optional):
|
|
2788
|
+
keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
|
|
2786
2789
|
are reduced are left in the result as dimensions with size one. With this option,
|
|
2787
2790
|
the result will broadcast correctly against the original `a`.
|
|
2788
2791
|
|
|
@@ -2826,7 +2829,7 @@ def exp2(x, dtype=None):
|
|
|
2826
2829
|
|
|
2827
2830
|
Args:
|
|
2828
2831
|
x (Tensor): input values.
|
|
2829
|
-
dtype (:class:`mindspore.dtype`, optional): Defaults to
|
|
2832
|
+
dtype (:class:`mindspore.dtype`, optional): Defaults to ``None``. Overrides the dtype of the
|
|
2830
2833
|
output Tensor.
|
|
2831
2834
|
|
|
2832
2835
|
Returns:
|
|
@@ -2924,7 +2927,7 @@ def cross(a, b, axisa=- 1, axisb=- 1, axisc=- 1, axis=None):
|
|
|
2924
2927
|
the last axis.
|
|
2925
2928
|
axis (int, optional): If defined, the axis of `a`, `b` and `c` that defines the
|
|
2926
2929
|
vector(s) and cross product(s). Overrides `axisa`, `axisb` and `axisc`.
|
|
2927
|
-
|
|
2930
|
+
Default: ``None`` .
|
|
2928
2931
|
|
|
2929
2932
|
Returns:
|
|
2930
2933
|
Tensor, vector cross product(s).
|
|
@@ -3016,7 +3019,7 @@ def ceil(x, dtype=None):
|
|
|
3016
3019
|
|
|
3017
3020
|
Args:
|
|
3018
3021
|
x (Tensor): input values.
|
|
3019
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
3022
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
3020
3023
|
output Tensor.
|
|
3021
3024
|
|
|
3022
3025
|
Returns:
|
|
@@ -3060,7 +3063,7 @@ def positive(a, dtype=None):
|
|
|
3060
3063
|
|
|
3061
3064
|
Args:
|
|
3062
3065
|
a (Tensor): Input tensor.
|
|
3063
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
3066
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
3064
3067
|
output Tensor.
|
|
3065
3068
|
|
|
3066
3069
|
Returns:
|
|
@@ -3091,7 +3094,7 @@ def negative(a, dtype=None):
|
|
|
3091
3094
|
|
|
3092
3095
|
Args:
|
|
3093
3096
|
a (Tensor): Input tensor.
|
|
3094
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
3097
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
3095
3098
|
output Tensor.
|
|
3096
3099
|
|
|
3097
3100
|
Returns:
|
|
@@ -3121,11 +3124,11 @@ def cumsum(a, axis=None, dtype=None):
|
|
|
3121
3124
|
Args:
|
|
3122
3125
|
a (Tensor): Input tensor.
|
|
3123
3126
|
axis (int, optional): Axis along which the cumulative sum is computed. The
|
|
3124
|
-
default (None) is to compute the cumsum over the flattened array.
|
|
3127
|
+
default ( ``None`` ) is to compute the cumsum over the flattened array.
|
|
3125
3128
|
dtype (:class:`mindspore.dtype`, optional): If not specified, stay the same as `a`,
|
|
3126
3129
|
unless `a` has an integer dtype with a precision less than that of the
|
|
3127
3130
|
default platform integer. In that case, the default platform integer
|
|
3128
|
-
is used. Default:
|
|
3131
|
+
is used. Default: ``None`` .
|
|
3129
3132
|
|
|
3130
3133
|
Returns:
|
|
3131
3134
|
Tensor.
|
|
@@ -3209,7 +3212,7 @@ def cbrt(x, dtype=None):
|
|
|
3209
3212
|
|
|
3210
3213
|
Args:
|
|
3211
3214
|
x (Tensor): Input tensor.
|
|
3212
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
3215
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
3213
3216
|
output Tensor.
|
|
3214
3217
|
|
|
3215
3218
|
Returns:
|
|
@@ -3247,7 +3250,7 @@ def log1p(x, dtype=None):
|
|
|
3247
3250
|
|
|
3248
3251
|
Args:
|
|
3249
3252
|
x (Tensor): Input array.
|
|
3250
|
-
dtype (:class:`mindspore.dtype`): Default:
|
|
3253
|
+
dtype (:class:`mindspore.dtype`): Default: ``None``. Overrides the dtype of the
|
|
3251
3254
|
output Tensor.
|
|
3252
3255
|
|
|
3253
3256
|
Returns:
|
|
@@ -3283,7 +3286,7 @@ def logaddexp(x1, x2, dtype=None):
|
|
|
3283
3286
|
x1 (Tensor): Input array.
|
|
3284
3287
|
x2 (Tensor): Input array. If ``x1.shape != x2.shape``, they must be broadcastable to
|
|
3285
3288
|
a common shape (which becomes the shape of the output).
|
|
3286
|
-
dtype (:class:`mindspore.dtype`): Default:
|
|
3289
|
+
dtype (:class:`mindspore.dtype`): Default: ``None``. Overrides the dtype of the
|
|
3287
3290
|
output Tensor.
|
|
3288
3291
|
|
|
3289
3292
|
Returns:
|
|
@@ -3315,7 +3318,7 @@ def log2(x, dtype=None):
|
|
|
3315
3318
|
|
|
3316
3319
|
Args:
|
|
3317
3320
|
x (Tensor): Input tensor.
|
|
3318
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3321
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3319
3322
|
output Tensor.
|
|
3320
3323
|
|
|
3321
3324
|
Returns:
|
|
@@ -3357,7 +3360,7 @@ def logaddexp2(x1, x2, dtype=None):
|
|
|
3357
3360
|
x1 (Tensor): Input tensor.
|
|
3358
3361
|
x2 (Tensor): Input tensor. If ``x1.shape != x2.shape``, they must be broadcastable to
|
|
3359
3362
|
a common shape (which becomes the shape of the output).
|
|
3360
|
-
dtype (:class:`mindspore.dtype`): Default:
|
|
3363
|
+
dtype (:class:`mindspore.dtype`): Default: ``None``. Overrides the dtype of the
|
|
3361
3364
|
output Tensor.
|
|
3362
3365
|
|
|
3363
3366
|
Returns:
|
|
@@ -3389,7 +3392,7 @@ def log10(x, dtype=None):
|
|
|
3389
3392
|
|
|
3390
3393
|
Args:
|
|
3391
3394
|
x (Tensor): Input tensor.
|
|
3392
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3395
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3393
3396
|
output Tensor.
|
|
3394
3397
|
|
|
3395
3398
|
Returns:
|
|
@@ -3431,7 +3434,7 @@ def sin(x, dtype=None):
|
|
|
3431
3434
|
|
|
3432
3435
|
Args:
|
|
3433
3436
|
x (Tensor): Input tensor.
|
|
3434
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3437
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3435
3438
|
output Tensor.
|
|
3436
3439
|
|
|
3437
3440
|
Returns:
|
|
@@ -3461,7 +3464,7 @@ def cos(x, dtype=None):
|
|
|
3461
3464
|
|
|
3462
3465
|
Args:
|
|
3463
3466
|
x (Tensor): Input tensor.
|
|
3464
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3467
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3465
3468
|
output Tensor.
|
|
3466
3469
|
|
|
3467
3470
|
Returns:
|
|
@@ -3492,7 +3495,7 @@ def tan(x, dtype=None):
|
|
|
3492
3495
|
|
|
3493
3496
|
Args:
|
|
3494
3497
|
x (Tensor): Input tensor.
|
|
3495
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3498
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3496
3499
|
output Tensor.
|
|
3497
3500
|
|
|
3498
3501
|
Returns:
|
|
@@ -3524,7 +3527,7 @@ def arcsin(x, dtype=None):
|
|
|
3524
3527
|
|
|
3525
3528
|
Args:
|
|
3526
3529
|
x (Tensor): Input tensor. y-coordinate on the unit circle.
|
|
3527
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3530
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3528
3531
|
output Tensor.
|
|
3529
3532
|
|
|
3530
3533
|
Returns:
|
|
@@ -3558,7 +3561,7 @@ def arccos(input, dtype=None):
|
|
|
3558
3561
|
Args:
|
|
3559
3562
|
input (Tensor): Input tensor. x-coordinate on the unit circle.
|
|
3560
3563
|
For real arguments, the domain is :math:`[-1, 1]`.
|
|
3561
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3564
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3562
3565
|
output Tensor.
|
|
3563
3566
|
|
|
3564
3567
|
Returns:
|
|
@@ -3593,7 +3596,7 @@ def arctan(x, dtype=None):
|
|
|
3593
3596
|
|
|
3594
3597
|
Args:
|
|
3595
3598
|
x (Tensor): Input tensor.
|
|
3596
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3599
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3597
3600
|
output Tensor.
|
|
3598
3601
|
|
|
3599
3602
|
Returns:
|
|
@@ -3622,7 +3625,7 @@ def sinh(x, dtype=None):
|
|
|
3622
3625
|
|
|
3623
3626
|
Args:
|
|
3624
3627
|
x (Tensor): Input tensor.
|
|
3625
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3628
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3626
3629
|
output Tensor.
|
|
3627
3630
|
|
|
3628
3631
|
Returns:
|
|
@@ -3651,7 +3654,7 @@ def cosh(x, dtype=None):
|
|
|
3651
3654
|
|
|
3652
3655
|
Args:
|
|
3653
3656
|
x (Tensor): Input tensor.
|
|
3654
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3657
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3655
3658
|
output Tensor.
|
|
3656
3659
|
|
|
3657
3660
|
Returns:
|
|
@@ -3680,7 +3683,7 @@ def tanh(x, dtype=None):
|
|
|
3680
3683
|
|
|
3681
3684
|
Args:
|
|
3682
3685
|
x (Tensor): Input tensor.
|
|
3683
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3686
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3684
3687
|
output Tensor.
|
|
3685
3688
|
|
|
3686
3689
|
Returns:
|
|
@@ -3709,7 +3712,7 @@ def arcsinh(x, dtype=None):
|
|
|
3709
3712
|
|
|
3710
3713
|
Args:
|
|
3711
3714
|
x (Tensor): Input tensor.
|
|
3712
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3715
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3713
3716
|
output Tensor.
|
|
3714
3717
|
|
|
3715
3718
|
Returns:
|
|
@@ -3738,7 +3741,7 @@ def arccosh(x, dtype=None):
|
|
|
3738
3741
|
|
|
3739
3742
|
Args:
|
|
3740
3743
|
x (Tensor): Input tensor.
|
|
3741
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3744
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3742
3745
|
output Tensor.
|
|
3743
3746
|
|
|
3744
3747
|
Returns:
|
|
@@ -3767,7 +3770,7 @@ def arctanh(x, dtype=None):
|
|
|
3767
3770
|
|
|
3768
3771
|
Args:
|
|
3769
3772
|
x (Tensor): Input tensor.
|
|
3770
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
3773
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None``. Overrides the dtype of the
|
|
3771
3774
|
output Tensor.
|
|
3772
3775
|
|
|
3773
3776
|
Returns:
|
|
@@ -3797,7 +3800,7 @@ def arctan2(x1, x2, dtype=None):
|
|
|
3797
3800
|
Args:
|
|
3798
3801
|
x1 (Tensor): input tensor.
|
|
3799
3802
|
x2 (Tensor): input tensor.
|
|
3800
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
3803
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
3801
3804
|
output Tensor.
|
|
3802
3805
|
|
|
3803
3806
|
Returns:
|
|
@@ -3869,13 +3872,13 @@ def corrcoef(x, y=None, rowvar=True, dtype=None):
|
|
|
3869
3872
|
multiple variables and observations. Each row of `x` represents a variable,
|
|
3870
3873
|
and each column a single observation of all those variables. Also see rowvar below.
|
|
3871
3874
|
y (Union[int, float, bool, tuple, list, Tensor], optional): An additional set
|
|
3872
|
-
of variables and observations. Default:
|
|
3873
|
-
rowvar (bool, optional): If rowvar is
|
|
3875
|
+
of variables and observations. Default: ``None`` .
|
|
3876
|
+
rowvar (bool, optional): If rowvar is ``True`` (default), then each row represents
|
|
3874
3877
|
a variable, with observations in the columns. Otherwise, the relationship
|
|
3875
3878
|
is transposed: each column represents a variable, while the rows contain observations.
|
|
3876
|
-
Default:
|
|
3879
|
+
Default: ``True`` .
|
|
3877
3880
|
dtype (:class:`mindspore.dtype`, optional): Data-type of the result. By default,
|
|
3878
|
-
the return data-type will have at least float32 precision. Default:
|
|
3881
|
+
the return data-type will have at least float32 precision. Default: ``None`` .
|
|
3879
3882
|
|
|
3880
3883
|
Returns:
|
|
3881
3884
|
Tensor, The correlation coefficient matrix of the variables.
|
|
@@ -3984,7 +3987,7 @@ def gradient(f, *varargs, axis=None, edge_order=1):
|
|
|
3984
3987
|
the gradient for all the axes of the input tensor. `axis` may be negative,
|
|
3985
3988
|
in which case it counts from the last to the first `axis`.
|
|
3986
3989
|
edge_order (int): Gradient is calculated using N-th order accurate differences
|
|
3987
|
-
at the boundaries. Default: 1.
|
|
3990
|
+
at the boundaries. Default: ``1`` .
|
|
3988
3991
|
|
|
3989
3992
|
Returns:
|
|
3990
3993
|
gradient, a list of tensors (or a single tensor if there is only one dimension
|
|
@@ -4126,7 +4129,7 @@ def _get_dims(shapes):
|
|
|
4126
4129
|
raise ValueError('Array must be 2 dimensional')
|
|
4127
4130
|
dims = tuple(map(operator.itemgetter(0), shapes))
|
|
4128
4131
|
if any(shape[1] != dim for shape, dim in zip(shapes[:-1], dims[1:])):
|
|
4129
|
-
raise ValueError(
|
|
4132
|
+
raise ValueError('Shapes{} are not aligned'.format(str(shapes)))
|
|
4130
4133
|
return dims + (shapes[-1][1],)
|
|
4131
4134
|
|
|
4132
4135
|
|
|
@@ -4229,7 +4232,7 @@ def argmax(a, axis=None):
|
|
|
4229
4232
|
a (Union[int, float, bool, list, tuple, Tensor]): Input array.
|
|
4230
4233
|
axis (int, optional): By default, the index is into
|
|
4231
4234
|
the flattened array, otherwise along the specified axis.
|
|
4232
|
-
Default:
|
|
4235
|
+
Default: ``None`` .
|
|
4233
4236
|
|
|
4234
4237
|
Returns:
|
|
4235
4238
|
Tensor, array of indices into the array. It has the same
|
|
@@ -4268,7 +4271,7 @@ def argmin(a, axis=None):
|
|
|
4268
4271
|
a (Union[int, float, bool, list, tuple, Tensor]): Input array.
|
|
4269
4272
|
axis (int, optional): By default, the index is into
|
|
4270
4273
|
the flattened array, otherwise along the specified axis.
|
|
4271
|
-
Default:
|
|
4274
|
+
Default: ``None`` .
|
|
4272
4275
|
|
|
4273
4276
|
Returns:
|
|
4274
4277
|
Tensor, array of indices into the array. It has the same
|
|
@@ -4311,8 +4314,8 @@ def searchsorted(a, v, side='left', sorter=None):
|
|
|
4311
4314
|
None, then it must be sorted in ascending order, otherwise `sorter` must be
|
|
4312
4315
|
an array of indices that sort it.
|
|
4313
4316
|
v (Union[int, float, bool, list, tuple, Tensor]): Values to insert into `a`.
|
|
4314
|
-
side ('left', 'right', optional): If 'left', the index of the first suitable
|
|
4315
|
-
location found is given. If 'right', return the last such index. If there is
|
|
4317
|
+
side ('left', 'right', optional): If ``'left'`` , the index of the first suitable
|
|
4318
|
+
location found is given. If ``'right'`` , return the last such index. If there is
|
|
4316
4319
|
no suitable index, return either 0 or N (where N is the length of `a`).
|
|
4317
4320
|
sorter (Union[int, float, bool, list, tuple, Tensor]): 1-D optional array of
|
|
4318
4321
|
integer indices that sort array `a` into ascending order. They are typically
|
|
@@ -4395,6 +4398,7 @@ def interp(x, xp, fp, left=None, right=None):
|
|
|
4395
4398
|
``Ascend`` ``GPU`` ``CPU``
|
|
4396
4399
|
|
|
4397
4400
|
Examples:
|
|
4401
|
+
>>> import mindspore.numpy as np
|
|
4398
4402
|
>>> xp = [1, 2, 3]
|
|
4399
4403
|
>>> fp = [3, 2, 0]
|
|
4400
4404
|
>>> print(np.interp([0, 1, 1.5, 2.72, 3.14], xp, fp))
|
|
@@ -4464,7 +4468,7 @@ def sign(x, dtype=None):
|
|
|
4464
4468
|
|
|
4465
4469
|
Args:
|
|
4466
4470
|
x (Union[int, float, list, tuple, Tensor]): Input values.
|
|
4467
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
4471
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
4468
4472
|
output Tensor.
|
|
4469
4473
|
|
|
4470
4474
|
Returns:
|
|
@@ -4514,7 +4518,7 @@ def copysign(x1, x2, dtype=None):
|
|
|
4514
4518
|
x1 (Union[int, float, list, tuple, Tensor]): Values to change the sign of.
|
|
4515
4519
|
x2 (Union[int, float, list, tuple, Tensor]): The sign of x2 is copied to x1. If `x1.shape != x2.shape`,
|
|
4516
4520
|
they must be broadcastable to a common shape (which becomes the shape of the output).
|
|
4517
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
4521
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
4518
4522
|
output Tensor.
|
|
4519
4523
|
|
|
4520
4524
|
Returns:
|
|
@@ -4624,10 +4628,10 @@ def bincount(x, weights=None, minlength=0, length=None):
|
|
|
4624
4628
|
Args:
|
|
4625
4629
|
x (Union[list, tuple, Tensor]): 1-d input array.
|
|
4626
4630
|
weights (Union[int, float, bool, list, tuple, Tensor], optional): Weights,
|
|
4627
|
-
array of the same shape as `x`.
|
|
4631
|
+
array of the same shape as `x`. Default: ``None`` .
|
|
4628
4632
|
minlength (int, optional): A minimum number of bins for the output array.
|
|
4629
|
-
|
|
4630
|
-
length (int, optional): Number of bins.
|
|
4633
|
+
Default: ``0`` .
|
|
4634
|
+
length (int, optional): Number of bins. Default: ``None`` .
|
|
4631
4635
|
|
|
4632
4636
|
Returns:
|
|
4633
4637
|
Tensor, the result of binning the input array. The length of out is equal to
|
|
@@ -5016,7 +5020,7 @@ def around(a, decimals=0):
|
|
|
5016
5020
|
|
|
5017
5021
|
Args:
|
|
5018
5022
|
a (Union[int, float, list, tuple, Tensor]): Input data.
|
|
5019
|
-
decimals (int): Number of decimal places to round to. Default: 0.
|
|
5023
|
+
decimals (int): Number of decimal places to round to. Default: ``0`` .
|
|
5020
5024
|
|
|
5021
5025
|
Returns:
|
|
5022
5026
|
Tensor. A tensor of the same type as a, containing the rounded values.
|
|
@@ -5166,7 +5170,7 @@ def polyder(p, m=1):
|
|
|
5166
5170
|
Args:
|
|
5167
5171
|
p (Union[int, float, bool, list, tuple, Tensor): Polynomial to differentiate.
|
|
5168
5172
|
A sequence is interpreted as polynomial coefficients.
|
|
5169
|
-
m (int, optional):
|
|
5173
|
+
m (int, optional): Default: ``1`` , order of differentiation.
|
|
5170
5174
|
|
|
5171
5175
|
Returns:
|
|
5172
5176
|
Tensor, a new polynomial representing the derivative.
|
|
@@ -5189,7 +5193,7 @@ def polyder(p, m=1):
|
|
|
5189
5193
|
return _to_tensor([])
|
|
5190
5194
|
for _ in range(m):
|
|
5191
5195
|
coeff = _to_tensor(F.make_range(_type_convert(int, p.size) - 1, 0, -1))
|
|
5192
|
-
p = p[:-1]*coeff
|
|
5196
|
+
p = p[:-1] * coeff
|
|
5193
5197
|
return p
|
|
5194
5198
|
|
|
5195
5199
|
|
|
@@ -5339,8 +5343,8 @@ def unwrap(p, discont=3.141592653589793, axis=-1):
|
|
|
5339
5343
|
|
|
5340
5344
|
Args:
|
|
5341
5345
|
p (Union[int, float, bool, list, tuple, Tensor): Input array.
|
|
5342
|
-
discont (float, optional): Maximum discontinuity between values, default
|
|
5343
|
-
axis (int, optional): Axis along which unwrap will operate, default
|
|
5346
|
+
discont (float, optional): Maximum discontinuity between values, default: ``pi`` .
|
|
5347
|
+
axis (int, optional): Axis along which unwrap will operate, default: ``-1`` .
|
|
5344
5348
|
|
|
5345
5349
|
Returns:
|
|
5346
5350
|
Tensor.
|
|
@@ -5366,9 +5370,9 @@ def unwrap(p, discont=3.141592653589793, axis=-1):
|
|
|
5366
5370
|
axis = _check_axis_in_range(axis, ndim)
|
|
5367
5371
|
dd = diff(p, axis=axis)
|
|
5368
5372
|
ddmod = remainder(add(dd, pi), 2*pi) - pi
|
|
5369
|
-
ddmod =
|
|
5373
|
+
ddmod = F.masked_fill(ddmod, F.logical_and(ddmod == -pi, dd > 0), pi)
|
|
5370
5374
|
ph_correct = ddmod - dd
|
|
5371
|
-
ph_correct =
|
|
5375
|
+
ph_correct = F.masked_fill(ph_correct, absolute(dd) < discont, 0)
|
|
5372
5376
|
slice_all = _list_comprehensions(F.rank(p), F.make_slice(None, None, None), True)
|
|
5373
5377
|
slice0 = _tuple_setitem(slice_all, axis, F.make_slice(0, 1, None))
|
|
5374
5378
|
slice1 = _tuple_setitem(slice_all, axis, F.make_slice(1, None, None))
|
|
@@ -5387,8 +5391,8 @@ def cumprod(a, axis=None, dtype=None):
|
|
|
5387
5391
|
Args:
|
|
5388
5392
|
a (Union[int, float, bool, list, tuple, Tensor]): Input tensor.
|
|
5389
5393
|
axis (int, optional): Axis along which the cumulative product is computed.
|
|
5390
|
-
By default the input is flattened. Default:
|
|
5391
|
-
dtype (:class:`mindspore.dtype`, optional): Default:
|
|
5394
|
+
By default the input is flattened. Default: ``None`` .
|
|
5395
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
5392
5396
|
output Tensor.
|
|
5393
5397
|
|
|
5394
5398
|
Returns:
|
|
@@ -5474,7 +5478,7 @@ def ravel_multi_index(multi_index, dims, mode='clip', order='C'):
|
|
|
5474
5478
|
multi_index (tuple of array_like):
|
|
5475
5479
|
A tuple of integer arrays, one array for each dimension.
|
|
5476
5480
|
dims (Union[int, tuple of integers]): The shape of array into which the indices from multi_index apply.
|
|
5477
|
-
mode ({`wrap`, `clip`}): Specifies how out-of-bounds indices are handled. Default:
|
|
5481
|
+
mode ({`wrap`, `clip`}): Specifies how out-of-bounds indices are handled. Default: ``clip''``.
|
|
5478
5482
|
|
|
5479
5483
|
- `wrap`: wrap around
|
|
5480
5484
|
- `clip`: clip to the range
|
|
@@ -5581,7 +5585,7 @@ def norm(x, ord=None, axis=None, keepdims=False): # pylint: disable=redefined-bu
|
|
|
5581
5585
|
`x` must be 1-D or 2-D, unless `ord` is None. If both `axis` and `ord` are None,
|
|
5582
5586
|
the 2-norm of ``x.ravel`` will be returned.
|
|
5583
5587
|
ord (Union[None, 'fro', 'nuc', inf, -inf, int, float], optional): Order of the norm.
|
|
5584
|
-
inf means numpy’s inf object.
|
|
5588
|
+
inf means numpy’s inf object. Default: ``None`` .
|
|
5585
5589
|
axis (Union[None, int, 2-tuple of integers], optional): If `axis` is an integer, it
|
|
5586
5590
|
specifies the axis of `x` along which to compute the vector norms. If `axis` is
|
|
5587
5591
|
a 2-tuple, it specifies the axes that hold 2-D matrices, and the matrix norms of
|
|
@@ -5644,7 +5648,7 @@ def bitwise_and(x1, x2, dtype=None):
|
|
|
5644
5648
|
x2 (Tensor): Input array. Only integer and boolean types are handled. If
|
|
5645
5649
|
``x1.shape != x2.shape``, they must be broadcastable to a common shape (which becomes
|
|
5646
5650
|
the shape of the output).
|
|
5647
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
5651
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
5648
5652
|
output Tensor.
|
|
5649
5653
|
|
|
5650
5654
|
Returns:
|
|
@@ -5676,7 +5680,7 @@ def bitwise_or(x1, x2, dtype=None):
|
|
|
5676
5680
|
x2 (Tensor): Input array. Only integer and boolean types are handled. If
|
|
5677
5681
|
``x1.shape != x2.shape``, they must be broadcastable to a common shape (which becomes
|
|
5678
5682
|
the shape of the output).
|
|
5679
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
5683
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
5680
5684
|
output Tensor.
|
|
5681
5685
|
|
|
5682
5686
|
Returns:
|
|
@@ -5708,7 +5712,7 @@ def bitwise_xor(x1, x2, dtype=None):
|
|
|
5708
5712
|
x2 (Tensor): Input array. Only integer and boolean types are handled. If
|
|
5709
5713
|
``x1.shape != x2.shape``, they must be broadcastable to a common shape (which becomes
|
|
5710
5714
|
the shape of the output).
|
|
5711
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
5715
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
5712
5716
|
output Tensor.
|
|
5713
5717
|
|
|
5714
5718
|
Returns:
|
|
@@ -5743,7 +5747,7 @@ def invert(x, dtype=None):
|
|
|
5743
5747
|
|
|
5744
5748
|
Args:
|
|
5745
5749
|
x (Tensor): Only integer and boolean types are handled.
|
|
5746
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
5750
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
5747
5751
|
output Tensor.
|
|
5748
5752
|
|
|
5749
5753
|
Returns:
|
|
@@ -5767,11 +5771,10 @@ def rint(x, dtype=None):
|
|
|
5767
5771
|
Note:
|
|
5768
5772
|
Numpy arguments `out`, `where`, `casting`, `order`, `subok`, `signature`, and `extobj` are
|
|
5769
5773
|
not supported.
|
|
5770
|
-
Ascend does not support dtype `float64` currently.
|
|
5771
5774
|
|
|
5772
5775
|
Args:
|
|
5773
|
-
x (Union[float, list, tuple, Tensor]): Input tensor.
|
|
5774
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
5776
|
+
x (Union[float, list, tuple, Tensor]): Input tensor of any dimension.
|
|
5777
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
5775
5778
|
output Tensor.
|
|
5776
5779
|
|
|
5777
5780
|
Returns:
|
|
@@ -5890,7 +5893,7 @@ def radians(x, dtype=None):
|
|
|
5890
5893
|
|
|
5891
5894
|
Args:
|
|
5892
5895
|
x (Tensor): Angles in degrees.
|
|
5893
|
-
dtype (:class:`mindspore.dtype`, optional):
|
|
5896
|
+
dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
|
|
5894
5897
|
output Tensor.
|
|
5895
5898
|
|
|
5896
5899
|
Returns:
|