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
|
@@ -21,7 +21,7 @@ A collection of operators to build neural networks or to compute functions.
|
|
|
21
21
|
|
|
22
22
|
from ._embedding_cache_ops import (CacheSwapTable, UpdateCache, MapCacheIdx, SubAndFilter,
|
|
23
23
|
MapUniform, DynamicAssign, PadAndShift)
|
|
24
|
-
from ._inner_ops import (MatmulDDS, DSDMatmul, Cummin, ExtractImagePatches)
|
|
24
|
+
from ._inner_ops import (MatmulDDS, DSDMatmul, Cummin, ExtractImagePatches, SelectView, CopyWithSlice)
|
|
25
25
|
from ._quant_ops import *
|
|
26
26
|
from ._thor_ops import (CusBatchMatMul, CusCholeskyTrsm, CusFusedAbsMax1, CusImg2Col, CusMatMulCubeDenseLeft,
|
|
27
27
|
CusMatMulCubeFraczRightMul, CusMatMulCube, CusMatrixCombine, CusTranspose02314,
|
|
@@ -29,26 +29,27 @@ from ._thor_ops import (CusBatchMatMul, CusCholeskyTrsm, CusFusedAbsMax1, CusImg
|
|
|
29
29
|
LoadIm2Col, UpdateThorGradient, CholeskyTrsm,
|
|
30
30
|
DetTriangle, ProdForceSeA)
|
|
31
31
|
from ._ms_kernel import (ms_kernel, kernel)
|
|
32
|
-
from .array_ops import (ArgMaxWithValue, ArgMinWithValue, Argmax, Argmin, BatchToSpace,
|
|
32
|
+
from .array_ops import (ArgMaxWithValue, ArgMinWithValue, Argmax, Argmin, BatchToSpace,
|
|
33
33
|
BatchToSpaceNDV2, BroadcastTo, Cast, Coalesce, Concat, Cummax, DType, DepthToSpace, Diag,
|
|
34
|
-
DiagPart,
|
|
35
|
-
Eye, Fill, Gather, GatherD, GatherNd,
|
|
34
|
+
DiagPart, EditDistance, EmbeddingLookup, ExpandDims, ExtractVolumePatches,
|
|
35
|
+
Eye, Fill, Gather, GatherD, GatherNd, Identity, Im2Col, InvertPermutation,
|
|
36
36
|
LowerBound, Lstsq, MaskedFill, MaskedSelect, Meshgrid, Mvlgamma, Ones, OnesLike,
|
|
37
|
-
|
|
38
|
-
ReverseSequence, ReverseV2, Rint,
|
|
37
|
+
Padding, ParallelConcat, PopulationCount, Range, Rank, Reshape, ResizeNearestNeighbor,
|
|
38
|
+
ReverseSequence, ReverseV2, Rint, ScalarToTensor, ScatterAdd,
|
|
39
39
|
ScatterDiv, ScatterMax, ScatterMin, ScatterMul, ScatterNd, ScatterNdAdd, ScatterNdDiv,
|
|
40
|
-
ScatterNdMax, ScatterNdMin, ScatterNdSub, ScatterNdUpdate,
|
|
40
|
+
ScatterNdMax, ScatterNdMin, ScatterNdSub, ScatterNdUpdate, ScatterSub,
|
|
41
41
|
ScatterUpdate, SearchSorted, Select, Shape, Size, Slice, Sort, SpaceToBatch, SpaceToBatchND,
|
|
42
42
|
SpaceToDepth, SparseGatherV2, Split, SplitV, Squeeze, Stack, StridedSlice, TensorScatterAdd,
|
|
43
43
|
TensorScatterDiv, TensorScatterMax, TensorScatterMin, TensorScatterMul, TensorScatterSub,
|
|
44
44
|
TensorScatterUpdate, TensorShape, Tile, TopK, TransShape, Transpose, TupleToArray, Unique,
|
|
45
|
-
UniqueWithPad,
|
|
45
|
+
UniqueWithPad, UnsortedSegmentMax, UnsortedSegmentMin, UnsortedSegmentProd,
|
|
46
46
|
UnsortedSegmentSum, Unstack, UpperBound, Zeros, ZerosLike, AffineGrid, Bincount, CheckNumerics,
|
|
47
47
|
HammingWindow, IdentityN, IndexFill, LeftShift, ListDiff, LogSpace, MatrixBandPart,
|
|
48
48
|
MatrixDiagPartV3, MatrixDiagV3, MatrixSetDiagV3, NonZero, Expand, Col2Im, ConjugateTranspose,
|
|
49
49
|
FillDiagonal, Fills, ResizeNearestNeighborV2, RightShift, ScatterAddWithAxis,
|
|
50
50
|
ScatterNdMul, SegmentMean, SegmentProd, SegmentSum, SegmentMax, SegmentMin, Tril, Triu,
|
|
51
|
-
UniqueConsecutive, UnravelIndex, FillV2, CountNonZero, TensorScatterElements
|
|
51
|
+
UniqueConsecutive, UnravelIndex, FillV2, CountNonZero, TensorScatterElements, IndexPut,
|
|
52
|
+
MaskedScatter)
|
|
52
53
|
from .comm_ops import (AllGather, AllReduce, NeighborExchange, NeighborExchangeV2, AlltoAll, _AllSwap, ReduceScatter,
|
|
53
54
|
Broadcast,
|
|
54
55
|
_MirrorOperator, _MirrorMiniStepOperator, _MiniStepAllGather, ReduceOp, _VirtualDataset,
|
|
@@ -68,7 +69,7 @@ from .inner_ops import (ScalarCast, Randperm, NoRepeatNGram, LambApplyOptimizerA
|
|
|
68
69
|
from .linalg_ops import (Svd, Geqrf)
|
|
69
70
|
from .math_ops import (Abs, ACos, Asin, Asinh, AddN, AccumulateNV2, AssignAdd, AssignSub, Atan2, BatchMatMul,
|
|
70
71
|
BitwiseAnd, BitwiseOr, Ger, BitwiseXor, Inv, Invert, ApproximateEqual,
|
|
71
|
-
InplaceAdd, InplaceSub,
|
|
72
|
+
InplaceAdd, InplaceSub, InplaceUpdateV2,
|
|
72
73
|
ReduceMax, ReduceMin, ReduceMean, ReduceSum, ReduceAll, ReduceProd, CumProd, Cdist, ReduceAny,
|
|
73
74
|
Cos, Cross, Div, DivNoNan, Equal, EqualCount, Exp, Expm1, Erf, Erfc, Floor, FloorDiv, FloorMod,
|
|
74
75
|
Ceil, Acosh, Greater, GreaterEqual, Lerp, Less, LessEqual, Log, Log1p, LogicalAnd, Mod,
|
|
@@ -78,7 +79,7 @@ from .math_ops import (Abs, ACos, Asin, Asinh, AddN, AccumulateNV2, AssignAdd, A
|
|
|
78
79
|
NPUGetFloatStatus, Pow, RealDiv, IsNan, IsInf, IsFinite, FloatStatus,
|
|
79
80
|
Reciprocal, CumSum, HistogramFixedWidth, SquaredDifference, Xdivy, Xlogy,
|
|
80
81
|
Sin, Sqrt, Rsqrt, BesselI0e, BesselI1e, TruncateDiv, TruncateMod, Addcdiv,
|
|
81
|
-
Addcmul, Square, Sub,
|
|
82
|
+
Addcmul, Square, Sub, Add, Sign, Round, SquareSumAll, Atan, Atanh, Cosh, Sinh, Eps,
|
|
82
83
|
Tan, MatrixInverse, IndexAdd, Erfinv, Conj, Real, Imag, Complex, Trunc, IsClose, LuSolve,
|
|
83
84
|
CholeskyInverse, BesselJ0, BesselJ1, BesselK0, BesselK0e, BesselK1, BesselK1e, BesselY0,
|
|
84
85
|
BesselY1, Bucketize, Cauchy, Cholesky, CholeskySolve, Betainc,
|
|
@@ -87,18 +88,18 @@ from .math_ops import (Abs, ACos, Asin, Asinh, AddN, AccumulateNV2, AssignAdd, A
|
|
|
87
88
|
NextAfter, Orgqr, Qr, RaggedRange, Digamma, Eig, EuclideanNorm, CompareAndBitpack, ComplexAbs,
|
|
88
89
|
CumulativeLogsumexp, Gcd, Polygamma, Trace, TridiagonalMatMul, TrilIndices, TriuIndices, Zeta,
|
|
89
90
|
Roll, Lgamma, Logit, MatrixSolveLs, Polar, Fmax, Fmin, Quantile, Sinc, Angle, Bernoulli,
|
|
90
|
-
NanToNum, Igamma, BesselI0, BesselI1, InplaceIndexAdd, Igammac)
|
|
91
|
+
NanToNum, Igamma, BesselI0, BesselI1, InplaceIndexAdd, Igammac, Ormqr)
|
|
91
92
|
from .nn_ops import (LSTM, SGD, Adam, AdamWeightDecay, FusedSparseAdam, FusedSparseLazyAdam, AdamNoUpdateParam,
|
|
92
93
|
ApplyMomentum, BatchNorm, BiasAdd, Conv2D, Conv3D, Conv2DTranspose, Conv3DTranspose,
|
|
93
94
|
DepthwiseConv2dNative,
|
|
94
|
-
|
|
95
|
-
InstanceNorm,
|
|
96
|
-
GeLU,
|
|
95
|
+
Dropout, Dropout2D, Dropout3D, Flatten,
|
|
96
|
+
InstanceNorm,
|
|
97
|
+
GeLU, FastGeLU, Elu, CeLU,
|
|
97
98
|
GetNext, L2Normalize, LayerNorm, L2Loss, CTCLoss, CTCLossV2, CTCLossV2Grad, CTCGreedyDecoder,
|
|
98
99
|
LogSoftmax, MaxPool3D, AvgPool3D,
|
|
99
100
|
MaxPool, DataFormatDimMap,
|
|
100
101
|
AvgPool, Conv2DBackpropInput, ComputeAccidentalHits,
|
|
101
|
-
|
|
102
|
+
MaxPoolWithArgmaxV2, OneHot, Pad, MirrorPad, Mish, PReLU, ReLU, ReLU6, ReLUV2,
|
|
102
103
|
HSwish, HSigmoid,
|
|
103
104
|
ResizeBilinear, Sigmoid, SeLU, HShrink, ApplyKerasMomentum,
|
|
104
105
|
SigmoidCrossEntropyWithLogits, NLLLoss, BCEWithLogitsLoss,
|
|
@@ -111,23 +112,30 @@ from .nn_ops import (LSTM, SGD, Adam, AdamWeightDecay, FusedSparseAdam, FusedSpa
|
|
|
111
112
|
ApplyAdaMax, ApplyAdadelta, ApplyAdagrad, ApplyAdagradV2, MultiMarginLoss, ApplyAdagradDA,
|
|
112
113
|
ApplyAddSign, ApplyPowerSign, ApplyGradientDescent, ApplyProximalGradientDescent,
|
|
113
114
|
ApplyRMSProp, ApplyCenteredRMSProp, BasicLSTMCell, InTopK, AdaptiveAvgPool2D, SoftShrink,
|
|
114
|
-
ApplyAdamWithAmsgrad, AdaptiveAvgPool3D, AdaptiveMaxPool2D,
|
|
115
|
+
ApplyAdamWithAmsgrad, ApplyAdamWithAmsgradV2, AdaptiveAvgPool3D, AdaptiveMaxPool2D,
|
|
116
|
+
AdaptiveMaxPool3D,
|
|
115
117
|
GridSampler3D, MaxPool3DWithArgmax, MaxUnpool2D, NuclearNorm, NthElement, MultilabelMarginLoss,
|
|
116
|
-
Dilation2D, DataFormatVecPermute, DeformableOffsets, FractionalAvgPool,
|
|
118
|
+
Dilation2D, DataFormatVecPermute, DeformableOffsets, Dense, FractionalAvgPool,
|
|
117
119
|
FractionalMaxPool, FractionalMaxPool3DWithFixedKsize, FractionalMaxPoolWithFixedKsize,
|
|
118
120
|
GridSampler2D, TripletMarginLoss, UpsampleNearest3D, UpsampleTrilinear3D, PadV3, ChannelShuffle,
|
|
119
121
|
GLU, MaxUnpool3D, Pdist)
|
|
120
122
|
from .other_ops import (Assign, IOU, BoundingBoxDecode, BoundingBoxEncode,
|
|
121
123
|
ConfusionMatrix, UpdateState, Load, StopGradient,
|
|
122
|
-
CheckValid, Partial, Depend,
|
|
124
|
+
CheckValid, Partial, Depend, Push, Pull, PyExecute, PyFunc, _DynamicLossScale,
|
|
123
125
|
SampleDistortedBoundingBoxV2)
|
|
124
126
|
from .random_ops import (RandomChoiceWithMask, StandardNormal, Gamma, RandomGamma, Poisson, UniformInt, UniformReal,
|
|
125
127
|
RandomCategorical, StandardLaplace, Multinomial, UniformCandidateSampler,
|
|
126
128
|
LogUniformCandidateSampler, TruncatedNormal, LogNormalReverse, NonDeterministicInts,
|
|
127
|
-
ParameterizedTruncatedNormal, RandomPoisson, MultinomialWithReplacement, RandomShuffle
|
|
129
|
+
ParameterizedTruncatedNormal, RandomPoisson, MultinomialWithReplacement, RandomShuffle,
|
|
130
|
+
RandpermV2)
|
|
128
131
|
from .rl_ops import (BufferAppend, BufferGetItem, BufferSample)
|
|
129
|
-
from .sparse_ops import (
|
|
132
|
+
from .sparse_ops import (
|
|
133
|
+
SparseToDense, SparseTensorDenseMatmul, SparseTensorDenseAdd, SparseSlice)
|
|
130
134
|
from .spectral_ops import (BartlettWindow, BlackmanWindow)
|
|
135
|
+
from ..deprecated import (identity, DropoutDoMask, MaxPoolWithArgmax,
|
|
136
|
+
BNTrainingReduce, BNTrainingUpdate, DropoutGenMask, Gelu, FastGelu,
|
|
137
|
+
TensorAdd, InplaceUpdate, ScatterNonAliasingAdd,
|
|
138
|
+
BatchToSpaceND, Unpack, GatherV2, DynamicShape, ScalarToArray, Pack)
|
|
131
139
|
|
|
132
140
|
__all__ = [
|
|
133
141
|
'HSVToRGB',
|
|
@@ -450,6 +458,7 @@ __all__ = [
|
|
|
450
458
|
"ApplyAdagradV2",
|
|
451
459
|
"ApplyAdagradDA",
|
|
452
460
|
"ApplyAdamWithAmsgrad",
|
|
461
|
+
"ApplyAdamWithAmsgradV2",
|
|
453
462
|
"ApplyAddSign",
|
|
454
463
|
"ApplyPowerSign",
|
|
455
464
|
"ApplyGradientDescent",
|
|
@@ -612,7 +621,10 @@ __all__ = [
|
|
|
612
621
|
"CumulativeLogsumexp",
|
|
613
622
|
"DataFormatVecPermute",
|
|
614
623
|
"DeformableOffsets",
|
|
624
|
+
"Dense",
|
|
615
625
|
"ExtractImagePatches",
|
|
626
|
+
"SelectView",
|
|
627
|
+
"CopyWithSlice",
|
|
616
628
|
"FillDiagonal",
|
|
617
629
|
"Fills",
|
|
618
630
|
"Gcd",
|
|
@@ -675,7 +687,11 @@ __all__ = [
|
|
|
675
687
|
"InplaceIndexAdd",
|
|
676
688
|
"Igammac",
|
|
677
689
|
"MaxUnpool3D",
|
|
678
|
-
"Pdist"
|
|
690
|
+
"Pdist",
|
|
691
|
+
"IndexPut",
|
|
692
|
+
"MaskedScatter",
|
|
693
|
+
"Ormqr",
|
|
694
|
+
"RandpermV2"
|
|
679
695
|
]
|
|
680
696
|
|
|
681
697
|
__custom__ = [
|
|
@@ -390,7 +390,7 @@ class Conv2DBackpropFilter(Primitive):
|
|
|
390
390
|
stride (tuple): The stride to be applied to the convolution filter. Default: (1, 1).
|
|
391
391
|
dilation (tuple): Specifies the dilation rate to be used for the dilated convolution. Default: (1, 1, 1, 1).
|
|
392
392
|
group (int): Splits input into groups. Default: 1.
|
|
393
|
-
data_format (str) - The format of input and output data. It should be 'NHWC' or 'NCHW'
|
|
393
|
+
data_format (str) - The format of input and output data. It should be 'NHWC' or 'NCHW', \
|
|
394
394
|
default is 'NCHW'.
|
|
395
395
|
|
|
396
396
|
Returns:
|
|
@@ -636,7 +636,7 @@ class EinsumGrad(PrimitiveWithInfer):
|
|
|
636
636
|
|
|
637
637
|
@prim_attr_register
|
|
638
638
|
def __init__(self, equation):
|
|
639
|
-
|
|
639
|
+
pass
|
|
640
640
|
|
|
641
641
|
def infer_shape(self, x_shapes, dout_shape):
|
|
642
642
|
out_shape = ()
|
|
@@ -1521,9 +1521,11 @@ class LSTMGrad(Primitive):
|
|
|
1521
1521
|
"""Computes the data and weight gradients of LSTM."""
|
|
1522
1522
|
|
|
1523
1523
|
@prim_attr_register
|
|
1524
|
-
def __init__(self, input_size, hidden_size, num_layers, has_bias, bidirectional, dropout):
|
|
1524
|
+
def __init__(self, input_size, hidden_size, num_layers, has_bias, bidirectional, dropout, proj_size=0):
|
|
1525
1525
|
self.input_size = validator.check_positive_int(input_size, 'input_size', self.name)
|
|
1526
1526
|
self.hidden_size = validator.check_positive_int(hidden_size, 'hidden_size', self.name)
|
|
1527
|
+
self.proj_size = validator.check_int_range(proj_size, 0, hidden_size, validator.INC_LEFT,
|
|
1528
|
+
'proj_size', self.name)
|
|
1527
1529
|
self.num_layers = validator.check_positive_int(num_layers, 'num_layers', self.name)
|
|
1528
1530
|
self.has_bias = validator.check_value_type('has_bias', has_bias, (bool,), self.name)
|
|
1529
1531
|
self.bidirectional = validator.check_value_type('bidirectional', bidirectional, (bool,), self.name)
|
|
@@ -1660,10 +1662,11 @@ class DynamicGRUV2Grad(Primitive):
|
|
|
1660
1662
|
keep_prob (float): A float identifying the keep prob in the op. Default: 1.0.
|
|
1661
1663
|
cell_clip (float): A float identifying the cell clip in the op. Default: -1.0.
|
|
1662
1664
|
num_proj (int): An integer identifying the num proj in the op. Default: 0.
|
|
1663
|
-
time_major (bool): A bool identifying the time major in the op. Default: True
|
|
1665
|
+
time_major (bool): A bool identifying the time major in the op. Default: ``True``.
|
|
1664
1666
|
gate_order (str): An string identifying the gate order in weight and bias. Default: 'rzh.
|
|
1665
1667
|
'zrh' is another option.
|
|
1666
|
-
reset_after (bool): An bool identifying whether to apply reset gate after matrix multiplication.
|
|
1668
|
+
reset_after (bool): An bool identifying whether to apply reset gate after matrix multiplication.
|
|
1669
|
+
Default: ``True``.
|
|
1667
1670
|
|
|
1668
1671
|
Inputs:
|
|
1669
1672
|
- **x** (Tensor) - Current words. Tensor of shape :math:`(num\_step, batch\_size, input\_size)`.
|
|
@@ -1887,7 +1890,7 @@ class ResizeNearestNeighborGrad(Primitive):
|
|
|
1887
1890
|
|
|
1888
1891
|
Args:
|
|
1889
1892
|
align_corners (bool): Whether the centers of the 4 corner pixels of the input
|
|
1890
|
-
and output tensors are aligned. Default: False
|
|
1893
|
+
and output tensors are aligned. Default: ``False``.
|
|
1891
1894
|
"""
|
|
1892
1895
|
|
|
1893
1896
|
@prim_attr_register
|
|
@@ -1925,77 +1928,50 @@ class ResizeNearestNeighborV2Grad(Primitive):
|
|
|
1925
1928
|
|
|
1926
1929
|
Args:
|
|
1927
1930
|
align_corners (bool): Whether the centers of the 4 corner pixels of the input
|
|
1928
|
-
and output tensors are aligned. Default: False
|
|
1929
|
-
half_pixel_centers (bool): Default: False
|
|
1930
|
-
data_format: An optional `string` that describes the format of the input `x` Defaults to `NHWC`.
|
|
1931
|
+
and output tensors are aligned. Default: ``False``.
|
|
1932
|
+
half_pixel_centers (bool): Default: ``False``.
|
|
1931
1933
|
"""
|
|
1932
1934
|
|
|
1933
1935
|
@prim_attr_register
|
|
1934
|
-
def __init__(self, align_corners=False, half_pixel_centers=False
|
|
1936
|
+
def __init__(self, align_corners=False, half_pixel_centers=False):
|
|
1935
1937
|
"""Initialize ResizeNearestNeighborV2Grad"""
|
|
1936
1938
|
self.init_prim_io_names(inputs=['grads', 'size'], outputs=['y'])
|
|
1937
|
-
|
|
1938
1939
|
validator.check_value_type('align_corners', align_corners, [bool], self.name)
|
|
1939
1940
|
validator.check_value_type('half_pixel_centers', half_pixel_centers, [bool], self.name)
|
|
1940
|
-
validator.check_value_type('data_format', data_format, [str], self.name)
|
|
1941
|
-
self.format = validator.check_string(data_format, ['NHWC', 'NCHW'], 'data_format', self.name)
|
|
1942
|
-
self.add_prim_attr('data_format', self.format)
|
|
1943
1941
|
|
|
1944
1942
|
|
|
1945
1943
|
class UpsampleNearest3DGrad(Primitive):
|
|
1946
1944
|
"""
|
|
1947
1945
|
Upsample the 3-D gradient data with the nearest neighbor interpolation algorithm.
|
|
1948
1946
|
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
Must: input_size[0] == grad_output_tensor_size[0], input_size[1] == grad_output_tensor_size[1].
|
|
1952
|
-
output_size (listInt): An optional listInt. Defaults to none.
|
|
1953
|
-
contain 3 elements: depth, height, width. The number of elements of 'output_size' should
|
|
1954
|
-
be the same as the rank of input 'grad_output'. Only one of 'scales' and 'output_size' can be specified.
|
|
1955
|
-
Must: grad_output_tensor_size[2] == floor(input_size[2] * scales[0]) == output_size[0]
|
|
1956
|
-
grad_output_tensor_size[3] == floor(input_size[3] * scales[1]) == output_size[1]
|
|
1957
|
-
grad_output_tensor_size[4] == floor(input_size[4] * scales[2]) == output_size[2].
|
|
1958
|
-
scales (listFloat): An optional listFloat. Defaults to none.
|
|
1959
|
-
The scale array along each dimension, contain 3 elements: scale_depth, scale_height, scale_width.
|
|
1960
|
-
The number of elements of 'scales' should be the same as the rank of input 'grad_output'.
|
|
1961
|
-
One of 'scales' and 'output_size' MUST be specified and it is an error if both are specified.
|
|
1947
|
+
Note:
|
|
1948
|
+
Only one of 'scales' and 'output_size' can be specified, and it is an error if both are specified.
|
|
1962
1949
|
|
|
1963
1950
|
Inputs:
|
|
1964
|
-
- **
|
|
1965
|
-
|
|
1951
|
+
- **dy** (Tensor) - Tensor of shape [N, C, D, H, W], Must be one of the following types:
|
|
1952
|
+
float16, float32, float64.
|
|
1953
|
+
- **input_size** (listInt): An required listInt, which contain 5 elements:
|
|
1954
|
+
[min_batch, channels, depth, height, width].
|
|
1955
|
+
Must: input_size[0] == dy_tensor_size[0], input_size[1] == dy_tensor_size[1].
|
|
1956
|
+
- **output_size** (listInt): An optional listInt. Default: ``None``.
|
|
1957
|
+
It contains 3 elements: depth, height, width, whose elements should be the same as `dy`.
|
|
1958
|
+
Must:
|
|
1959
|
+
dy_tensor_size[2] == floor(input_size[2] * scales[0]) == output_size[0],
|
|
1960
|
+
dy_tensor_size[3] == floor(input_size[3] * scales[1]) == output_size[1],
|
|
1961
|
+
dy_tensor_size[4] == floor(input_size[4] * scales[2]) == output_size[2].
|
|
1962
|
+
- **scales** (listFloat): An optional listFloat. Default: ``None``.
|
|
1963
|
+
The scale array along each dimension, contain 3 elements: scale_depth, scale_height, scale_width.
|
|
1964
|
+
The number of elements of 'scales' should be the same as the rank of `dy`.
|
|
1966
1965
|
|
|
1967
1966
|
Outputs:
|
|
1968
|
-
Tensor
|
|
1969
|
-
|
|
1970
|
-
Raises:
|
|
1971
|
-
TypeError: If `input_size` is not listInt.
|
|
1972
|
-
TypeError: When `output_size` is not none and `output_size` is not listInt.
|
|
1973
|
-
TypeError: When `scales` is not none and `scales` is not listFloat.
|
|
1974
|
-
TypeError: If dtype of `x` is not int [float16, float32, float64].
|
|
1975
|
-
ValueError: If any value of `input_size` is negative.
|
|
1976
|
-
ValueError: If any value of `output_size` is negative.
|
|
1977
|
-
ValueError: If any value of `scales` is negative.
|
|
1978
|
-
ValueError: If shape of `x` is not 5D.
|
|
1979
|
-
|
|
1980
|
-
Supported Platforms:
|
|
1981
|
-
``Ascend`` ``GPU`` ``CPU``
|
|
1967
|
+
- **dx**- (Tensor) - A 5-D tensor. Has the same type as `dy`, shape depends on `input_size`.
|
|
1982
1968
|
"""
|
|
1983
1969
|
@prim_attr_register
|
|
1984
|
-
def __init__(self
|
|
1970
|
+
def __init__(self):
|
|
1985
1971
|
"""Initialize UpsampleNearest3DGrad."""
|
|
1986
|
-
self.init_prim_io_names(
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
if output_size is not None:
|
|
1990
|
-
validator.check_value_type("output_size", output_size, [list, tuple], self.name)
|
|
1991
|
-
validator.check_positive_int_sequence(output_size, "output_size", self.name)
|
|
1992
|
-
else:
|
|
1993
|
-
self.add_prim_attr("output_size", [])
|
|
1994
|
-
if scales is not None:
|
|
1995
|
-
validator.check_value_type("scales", scales, [list, tuple], self.name)
|
|
1996
|
-
validator.check_positive_float_sequence(scales, "scales", self.name)
|
|
1997
|
-
else:
|
|
1998
|
-
self.add_prim_attr("scales", [])
|
|
1972
|
+
self.init_prim_io_names(
|
|
1973
|
+
inputs=['dy', 'input_size', 'output_size', 'scales'],
|
|
1974
|
+
outputs=['dx'])
|
|
1999
1975
|
|
|
2000
1976
|
|
|
2001
1977
|
class ROIAlignGrad(Primitive):
|
|
@@ -2130,11 +2106,13 @@ class NLLLossGrad(PrimitiveWithInfer):
|
|
|
2130
2106
|
"""Computes the gradients of `NLLLoss`."""
|
|
2131
2107
|
|
|
2132
2108
|
@prim_attr_register
|
|
2133
|
-
def __init__(self, reduction="mean"):
|
|
2109
|
+
def __init__(self, reduction="mean", ignore_index=-100):
|
|
2134
2110
|
"""Initialize NLLLoss"""
|
|
2135
2111
|
self.init_prim_io_names(inputs=['x', 'loss_grad', 'target', 'weight', 'total_weight'], outputs=['x_grad'])
|
|
2136
2112
|
self.reduction = validator.check_string(reduction, ['none', 'sum', 'mean'], 'reduction', self.name)
|
|
2113
|
+
self.ignore_index = ignore_index
|
|
2137
2114
|
self.add_prim_attr('reduction', self.reduction)
|
|
2115
|
+
self.add_prim_attr('ignore_index', self.ignore_index)
|
|
2138
2116
|
|
|
2139
2117
|
|
|
2140
2118
|
class SmoothL1LossGrad(Primitive):
|
|
@@ -2182,7 +2160,6 @@ class StridedSliceV2Grad(Primitive):
|
|
|
2182
2160
|
new_axis_mask=0,
|
|
2183
2161
|
shrink_axis_mask=0):
|
|
2184
2162
|
"""Initialize StridedSliceV2Grad"""
|
|
2185
|
-
self.set_const_input_indexes([0])
|
|
2186
2163
|
self.init_prim_io_names(inputs=['shapex', 'begin', 'end', 'strides', 'dy'], outputs=['output'])
|
|
2187
2164
|
|
|
2188
2165
|
|
|
@@ -2240,7 +2217,6 @@ class MirrorPadGrad(Primitive):
|
|
|
2240
2217
|
@prim_attr_register
|
|
2241
2218
|
def __init__(self, mode="REFLECT"):
|
|
2242
2219
|
"""Initialize MirrorPad"""
|
|
2243
|
-
self.set_const_input_indexes([1])
|
|
2244
2220
|
self.init_prim_io_names(inputs=['dy', 'paddings'], outputs=['output'])
|
|
2245
2221
|
validator.check_string(mode, ['REFLECT', 'SYMMETRIC'], 'mode', self.name)
|
|
2246
2222
|
self.mode = mode
|
|
@@ -2256,7 +2232,6 @@ class PadV3Grad(Primitive):
|
|
|
2256
2232
|
self.init_prim_io_names(inputs=['x', 'paddings'], outputs=['y'])
|
|
2257
2233
|
validator.check_string(mode, ['reflect', 'edge', 'circular'], 'mode', self.name)
|
|
2258
2234
|
validator.check_bool(paddings_contiguous, "paddings_contiguous", self.name)
|
|
2259
|
-
self.set_const_input_indexes([1])
|
|
2260
2235
|
self.mode = mode
|
|
2261
2236
|
self.paddings_contiguous = paddings_contiguous
|
|
2262
2237
|
|
|
@@ -2371,14 +2346,14 @@ class BasicLSTMCellCStateGrad(PrimitiveWithInfer):
|
|
|
2371
2346
|
return (dgate_shape, dct_1_shape)
|
|
2372
2347
|
|
|
2373
2348
|
def infer_dtype(self, c_dtype, dht_dtype, dct_dtype, it_dtype, jt_dtype, ft_dtype, ot_dtype, tanhct_dtype):
|
|
2374
|
-
validator.check_subclass("c", c_dtype, [mstype.
|
|
2375
|
-
validator.check_subclass("dht", dht_dtype, [mstype.
|
|
2376
|
-
validator.check_subclass("dct", dct_dtype, [mstype.
|
|
2377
|
-
validator.check_subclass("it", it_dtype, [mstype.
|
|
2378
|
-
validator.check_subclass("jt", jt_dtype, [mstype.
|
|
2379
|
-
validator.check_subclass("ft", ft_dtype, [mstype.
|
|
2380
|
-
validator.check_subclass("ot", ot_dtype, [mstype.
|
|
2381
|
-
validator.check_subclass("tanhct", tanhct_dtype, [mstype.
|
|
2349
|
+
validator.check_subclass("c", c_dtype, [mstype.tensor_type], self.name)
|
|
2350
|
+
validator.check_subclass("dht", dht_dtype, [mstype.tensor_type], self.name)
|
|
2351
|
+
validator.check_subclass("dct", dct_dtype, [mstype.tensor_type], self.name)
|
|
2352
|
+
validator.check_subclass("it", it_dtype, [mstype.tensor_type], self.name)
|
|
2353
|
+
validator.check_subclass("jt", jt_dtype, [mstype.tensor_type], self.name)
|
|
2354
|
+
validator.check_subclass("ft", ft_dtype, [mstype.tensor_type], self.name)
|
|
2355
|
+
validator.check_subclass("ot", ot_dtype, [mstype.tensor_type], self.name)
|
|
2356
|
+
validator.check_subclass("tanhct", tanhct_dtype, [mstype.tensor_type], self.name)
|
|
2382
2357
|
validator.check_type_name("c", c_dtype, [mstype.float16, mstype.float32], self.name)
|
|
2383
2358
|
validator.check_type_name("dht", dht_dtype, [mstype.float16, mstype.float32], self.name)
|
|
2384
2359
|
validator.check_type_name("dct", dct_dtype, [mstype.float16, mstype.float32], self.name)
|
|
@@ -2411,9 +2386,9 @@ class BasicLSTMCellWeightGrad(PrimitiveWithInfer):
|
|
|
2411
2386
|
return (dw_shape, db_shape)
|
|
2412
2387
|
|
|
2413
2388
|
def infer_dtype(self, x_dtype, h_dtype, dgate_dtype):
|
|
2414
|
-
validator.check_subclass("x", x_dtype, mstype.
|
|
2415
|
-
validator.check_subclass("h", h_dtype, mstype.
|
|
2416
|
-
validator.check_subclass("dgate", dgate_dtype, mstype.
|
|
2389
|
+
validator.check_subclass("x", x_dtype, mstype.tensor_type, self.name)
|
|
2390
|
+
validator.check_subclass("h", h_dtype, mstype.tensor_type, self.name)
|
|
2391
|
+
validator.check_subclass("dgate", dgate_dtype, mstype.tensor_type, self.name)
|
|
2417
2392
|
validator.check_type_name("x", x_dtype, [mstype.float16, mstype.float32], self.name)
|
|
2418
2393
|
validator.check_type_name("h", h_dtype, [mstype.float16, mstype.float32], self.name)
|
|
2419
2394
|
validator.check_type_name("dgate", dgate_dtype, [mstype.float16, mstype.float32], self.name)
|
|
@@ -2440,8 +2415,8 @@ class BasicLSTMCellInputGrad(PrimitiveWithInfer):
|
|
|
2440
2415
|
return (dxt_shape, dht_shape)
|
|
2441
2416
|
|
|
2442
2417
|
def infer_dtype(self, dgate_dtype, w_dtype):
|
|
2443
|
-
validator.check_subclass("dgate", dgate_dtype, mstype.
|
|
2444
|
-
validator.check_subclass("w", w_dtype, mstype.
|
|
2418
|
+
validator.check_subclass("dgate", dgate_dtype, mstype.tensor_type, self.name)
|
|
2419
|
+
validator.check_subclass("w", w_dtype, mstype.tensor_type, self.name)
|
|
2445
2420
|
validator.check_type_name("dgate", dgate_dtype, [mstype.float16, mstype.float32], self.name)
|
|
2446
2421
|
validator.check_type_name("w", w_dtype, [mstype.float16, mstype.float32], self.name)
|
|
2447
2422
|
return (dgate_dtype, dgate_dtype)
|
|
@@ -2600,7 +2575,12 @@ class MultilabelMarginLossGrad(Primitive):
|
|
|
2600
2575
|
Compute the gradients of MultilabelMarginLoss operation.
|
|
2601
2576
|
|
|
2602
2577
|
Args:
|
|
2603
|
-
reduction (str): Apply specific reduction method to the output: 'none', 'mean',
|
|
2578
|
+
reduction (str, optional): Apply specific reduction method to the output: ``'none'`` , ``'mean'`` ,
|
|
2579
|
+
``'sum'`` . Default: ``'mean'`` .
|
|
2580
|
+
|
|
2581
|
+
- ``'none'``: no reduction will be applied.
|
|
2582
|
+
- ``'mean'``: compute and return the mean of elements in the output.
|
|
2583
|
+
- ``'sum'``: the output elements will be summed.
|
|
2604
2584
|
|
|
2605
2585
|
Inputs:
|
|
2606
2586
|
- **y_grad** (Tensor) - The gradients of loss to output of MultilabelMarginLoss function, with
|
|
@@ -2622,7 +2602,7 @@ class MultilabelMarginLossGrad(Primitive):
|
|
|
2622
2602
|
TypeError: If dtype of `y_grad` is not the same as `x`.
|
|
2623
2603
|
ValueError: If length of shape of `x` is neither 1 nor 2.
|
|
2624
2604
|
ValueError: If shape of `x` is not the same as `target`.
|
|
2625
|
-
ValueError: If `reduction` is not one of 'none'
|
|
2605
|
+
ValueError: If `reduction` is not one of ``'none'``, ``'mean'``, ``'sum'``.
|
|
2626
2606
|
ValueError: If shape of `y_grad` is not the same as forward output `y`.
|
|
2627
2607
|
|
|
2628
2608
|
Supported Platforms:
|
|
@@ -2889,7 +2869,9 @@ class Dilation2DBackpropFilter(Primitive):
|
|
|
2889
2869
|
self.pad_mode = validator.check_string(self.pad_mode, ["SAME", "VALID", 'same', "valid"], "pad_mode", self.name)
|
|
2890
2870
|
self.add_prim_attr("pad_mode", self.pad_mode.upper())
|
|
2891
2871
|
self.stride = _check_format_stride_or_dilation("stride", stride, self.name, self.data_format)
|
|
2892
|
-
|
|
2872
|
+
def is_in_range(x):
|
|
2873
|
+
return 1 <= x <= 255
|
|
2874
|
+
if not is_in_range(self.stride[2]) or not is_in_range(self.stride[3]):
|
|
2893
2875
|
raise ValueError(f"For '{self.name}', size of stride is not supported, "
|
|
2894
2876
|
f'stride should be in the range of [1, 255], '
|
|
2895
2877
|
f'but got stride_h: `{self.stride[2]}`, stride_w: `{self.stride[3]}`.')
|
|
@@ -2944,7 +2926,12 @@ class MultiMarginLossGrad(Primitive):
|
|
|
2944
2926
|
Args:
|
|
2945
2927
|
p (int): Optional. The norm degree for pairwise distance.Should be 1 or 2. Default: 1.
|
|
2946
2928
|
margin (float): Optional. A parameter to change pairwise distance. Default: 1.0.
|
|
2947
|
-
reduction (str): Apply specific reduction method to the output: 'none', 'mean',
|
|
2929
|
+
reduction (str, optional): Apply specific reduction method to the output: ``'none'`` , ``'mean'`` ,
|
|
2930
|
+
``'sum'`` . Default: ``'mean'`` .
|
|
2931
|
+
|
|
2932
|
+
- ``'none'``: no reduction will be applied.
|
|
2933
|
+
- ``'mean'``: compute and return the weighted mean of elements in the output.
|
|
2934
|
+
- ``'sum'``: the output elements will be summed.
|
|
2948
2935
|
|
|
2949
2936
|
Inputs:
|
|
2950
2937
|
- **y_grad** (Tensor) - If it's not a scalar, the shape of 'y_grad' :math:`(N, C)`.
|
|
@@ -2953,7 +2940,7 @@ class MultiMarginLossGrad(Primitive):
|
|
|
2953
2940
|
- **target** (Tensor) - Ground truth labels, with shape :math:`(N,)`. Data type only support int64. The
|
|
2954
2941
|
value of target should be non-negative, less than C.
|
|
2955
2942
|
- **weight** (Tensor, optional) - The rescaling weight to each class with shape :math:`(C,)`. Data type only
|
|
2956
|
-
support float32, float16 or float64. Default: None
|
|
2943
|
+
support float32, float16 or float64. Default: ``None``.
|
|
2957
2944
|
|
|
2958
2945
|
Outputs:
|
|
2959
2946
|
The shape of output :math:`(N, C)`. Data type only support float32 or float16, float64.
|
|
@@ -2990,77 +2977,38 @@ class UpsampleTrilinear3DGrad(Primitive):
|
|
|
2990
2977
|
r"""
|
|
2991
2978
|
Upsample the 3-D gradient data with trilinear interpolation algorithm.
|
|
2992
2979
|
|
|
2980
|
+
Note:
|
|
2981
|
+
One of 'scales' and 'output_size' must be specified. And it is an error if both are specified.
|
|
2982
|
+
|
|
2993
2983
|
Args:
|
|
2994
|
-
|
|
2995
|
-
contain 5 elements: [batch, channels, depth, height, width]. Must:
|
|
2996
|
-
input_size[0] == grad_output_tensor_size[0]
|
|
2997
|
-
input_size[1] == grad_output_tensor_size[1].
|
|
2998
|
-
output_size (Union[tuple[int], list[int]]): An optional listInt. Defaults to none.
|
|
2999
|
-
contain 3 elements: depth, height, width. The number of elements of 'output_size' should
|
|
3000
|
-
be the same as the rank of input 'grad_output'.
|
|
3001
|
-
Only one of 'scales' and 'output_size' can be specified. Must:
|
|
3002
|
-
grad_output_tensor_size[2] == floor(input_size[2] * scales[0]) == output_size[0]
|
|
3003
|
-
grad_output_tensor_size[3] == floor(input_size[3] * scales[1]) == output_size[1]
|
|
3004
|
-
grad_output_tensor_size[4] == floor(input_size[4] * scales[2]) == output_size[2].
|
|
3005
|
-
scales (Union[tuple[float], list[float]]): An optional listFloat. Defaults to none.
|
|
3006
|
-
The scale array along each dimension, contain 3 elements: scale_depth, scale_height, scale_width.
|
|
3007
|
-
The number of elements of 'scales' should be the same as the rank of input 'grad_output'.
|
|
3008
|
-
One of 'scales' and 'output_size' MUST be specified and it is an error if both are specified.
|
|
3009
|
-
align_corners (bool): An optional bool. Defaults to false.
|
|
2984
|
+
align_corners (bool): An optional bool. Default: ``False``.
|
|
3010
2985
|
|
|
3011
2986
|
Inputs:
|
|
3012
|
-
- **
|
|
3013
|
-
|
|
2987
|
+
- **dy** (Tensor) - Tensor of shape [N, C, D, H, W]. Must be one of the following types:
|
|
2988
|
+
float16, float32, float64.
|
|
2989
|
+
- **input_size** (Union[tuple[int], list[int]]): An required listInt which contains 5 elements:
|
|
2990
|
+
[batch, channels, depth, height, width]. Must:
|
|
2991
|
+
input_size[0] == dy_tensor_size[0]
|
|
2992
|
+
input_size[1] == dy_tensor_size[1].
|
|
2993
|
+
- **output_size** (Union[tuple[int], list[int]]): An optional listInt. Default: ``None``.
|
|
2994
|
+
It contains 3 elements: depth, height, width, whose elements should be the same as `dy`. Must:
|
|
2995
|
+
dy_tensor_size[2] == floor(input_size[2] * scales[0]) == output_size[0]
|
|
2996
|
+
dy_tensor_size[3] == floor(input_size[3] * scales[1]) == output_size[1]
|
|
2997
|
+
dy_tensor_size[4] == floor(input_size[4] * scales[2]) == output_size[2].
|
|
2998
|
+
- **scales** (Union[tuple[float], list[float]]): An optional listFloat. Default: ``None``.
|
|
2999
|
+
The scale array along each dimension, contain 3 elements: scale_depth, scale_height, scale_width.
|
|
3000
|
+
The number of elements of 'scales' should be the same as the rank of input `dy`.
|
|
3014
3001
|
|
|
3015
3002
|
Outputs:
|
|
3016
|
-
|
|
3017
|
-
Must be one of the following types: [float16, float32, float64].
|
|
3018
|
-
|
|
3019
|
-
Raises:
|
|
3020
|
-
TypeError: If dtype of `x` is not int [float16, float32, float64].
|
|
3021
|
-
TypeError: If `input_size` is not list[int] or tuple[int].
|
|
3022
|
-
TypeError: When `output_size` is not none and `output_size` is not list[int] or tuple[int].
|
|
3023
|
-
TypeError: When `scales` is not none and `scales` is not list[float] or tuple[float].
|
|
3024
|
-
TypeError: If type of `align_corners` is not bool.
|
|
3025
|
-
ValueError: If any value of `output_size` is negative or zero when `output_size` is not empty.
|
|
3026
|
-
ValueError: If any value of `scales` is negative or zero when `scales` is not empty.
|
|
3027
|
-
ValueError: If shape of `x` is not 5D.
|
|
3028
|
-
ValueError: If none of `scales` and `output_size` is specified or both specified.
|
|
3029
|
-
ValueError: If size of `scales` is not equal 3 when `scales` is specified.
|
|
3030
|
-
ValueError: If size of `output_size` is not equal 3 when `output_size` is specified.
|
|
3031
|
-
TypeError: If `input_size` is not Union[tuple[int], list[int]].
|
|
3032
|
-
ValueError: If any value of `input_size` is negative.
|
|
3033
|
-
ValueError: If elements number of `input_size` is not 5.
|
|
3034
|
-
|
|
3035
|
-
Supported Platforms:
|
|
3036
|
-
``Ascend`` ``GPU`` ``CPU``
|
|
3003
|
+
- **dx** (Tensor) - A Tensor with shape depending on intput_size, and its' dtype is the same as `dy`.
|
|
3037
3004
|
"""
|
|
3038
3005
|
@prim_attr_register
|
|
3039
|
-
def __init__(self,
|
|
3006
|
+
def __init__(self, align_corners=False):
|
|
3040
3007
|
"""Initialize UpsampleTrilinear3DGrad."""
|
|
3041
|
-
self.init_prim_io_names(
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
self.scales = [] if scales is None else scales
|
|
3008
|
+
self.init_prim_io_names(
|
|
3009
|
+
inputs=['dy', 'input_size', 'output_size', 'scales'],
|
|
3010
|
+
outputs=['dx'])
|
|
3045
3011
|
self.align_corners = align_corners
|
|
3046
|
-
|
|
3047
|
-
validator.check_value_type("input_size", self.input_size, [list, tuple], self.name)
|
|
3048
|
-
validator.check_equal_int(len(self.input_size), 5, "the dimension of input_size", self.name)
|
|
3049
|
-
validator.check_value_type("output_size", self.output_size, [list, tuple], self.name)
|
|
3050
|
-
validator.check_value_type("scales", self.scales, [list, tuple], self.name)
|
|
3051
|
-
validator.check_bool(self.align_corners, self.name)
|
|
3052
|
-
if len(self.output_size) == 3:
|
|
3053
|
-
validator.check_positive_int_sequence(self.output_size, "output_size", self.name)
|
|
3054
|
-
if len(self.scales) == 3:
|
|
3055
|
-
validator.check_positive_float_sequence(self.scales, "scales", self.name)
|
|
3056
|
-
if self.output_size == []:
|
|
3057
|
-
validator.check_equal_int(len(self.scales), 3, 'size of scales', self.name)
|
|
3058
|
-
if self.scales == []:
|
|
3059
|
-
validator.check_equal_int(len(self.output_size), 3, 'size of output_size', self.name)
|
|
3060
|
-
|
|
3061
|
-
self.add_prim_attr('input_size', self.input_size)
|
|
3062
|
-
self.add_prim_attr('output_size', self.output_size)
|
|
3063
|
-
self.add_prim_attr('scales', self.scales)
|
|
3064
3012
|
self.add_prim_attr('align_corners', self.align_corners)
|
|
3065
3013
|
|
|
3066
3014
|
|
|
@@ -3341,7 +3289,7 @@ class DeformableOffsetsGrad(Primitive):
|
|
|
3341
3289
|
data_format (str): An optional string from:"NCHW", "NHWC".Specify the data format of the input x. Default:
|
|
3342
3290
|
"NCHW".
|
|
3343
3291
|
deformable_groups (int): Specify the C-axis grouping number of input x. Default: 1.
|
|
3344
|
-
modulated (bool): Specify version of DeformableOffsetsGrad, true means v2, false means v1. Default:
|
|
3292
|
+
modulated (bool): Specify version of DeformableOffsetsGrad, true means v2, false means v1. Default: ``True``.
|
|
3345
3293
|
|
|
3346
3294
|
Inputs:
|
|
3347
3295
|
- **grad** (Tensor) - The input grad tensor. With float16 or float32 data type.
|
|
@@ -3576,8 +3524,8 @@ class ResizeBicubicGrad(Primitive):
|
|
|
3576
3524
|
|
|
3577
3525
|
Args:
|
|
3578
3526
|
align_corners (bool):If true, the centers of the 4 corner pixels of the input
|
|
3579
|
-
and output tensors are aligned, preserving the values at the corner pixels.Default: False
|
|
3580
|
-
half_pixel_centers (bool): An optional bool. Default: False
|
|
3527
|
+
and output tensors are aligned, preserving the values at the corner pixels.Default: ``False``.
|
|
3528
|
+
half_pixel_centers (bool): An optional bool. Default: ``False``.
|
|
3581
3529
|
|
|
3582
3530
|
Inputs:
|
|
3583
3531
|
- **grads** (Tensor) - A Tensor of type float. 4-D with shape
|
|
@@ -3611,11 +3559,13 @@ class ResizeBicubicGrad(Primitive):
|
|
|
3611
3559
|
original_image_shape = list(original_image['shape'])
|
|
3612
3560
|
# get value
|
|
3613
3561
|
if grads['value'] is None:
|
|
3614
|
-
raise ValueError(
|
|
3615
|
-
|
|
3562
|
+
raise ValueError(
|
|
3563
|
+
f"For '{self.name}', the 'grads' cannot be None, but got {grads['value']}."
|
|
3564
|
+
)
|
|
3616
3565
|
if original_image['value'] is None:
|
|
3617
|
-
raise ValueError(
|
|
3618
|
-
|
|
3566
|
+
raise ValueError(
|
|
3567
|
+
f"For '{self.name}', the 'original_image' cannot be None, but got {original_image['value']}."
|
|
3568
|
+
)
|
|
3619
3569
|
# get dtype
|
|
3620
3570
|
grads_dtype = grads['dtype']
|
|
3621
3571
|
original_image_dtype = original_image['dtype']
|
|
@@ -3737,7 +3687,7 @@ class AffineGridGrad(Primitive):
|
|
|
3737
3687
|
|
|
3738
3688
|
Args:
|
|
3739
3689
|
align_corners (bool): if True, consider -1 and 1 to refer to the centers
|
|
3740
|
-
of the corner pixels rather than the image corners. Default: False
|
|
3690
|
+
of the corner pixels rather than the image corners. Default: ``False``.
|
|
3741
3691
|
|
|
3742
3692
|
Inputs:
|
|
3743
3693
|
- **y_grad** (Tensor) - Data type must be float16 or float32.
|
|
@@ -3867,3 +3817,49 @@ class ResizeV2Grad(Primitive):
|
|
|
3867
3817
|
["align_corners", "half_pixel"], "coordinate_transformation_mode", self.name)
|
|
3868
3818
|
validator.check_value_type("mode", mode, [str], self.name)
|
|
3869
3819
|
validator.check_string(mode, ["nearest", "linear", "cubic"], "mode", self.name)
|
|
3820
|
+
|
|
3821
|
+
|
|
3822
|
+
class WKVGrad(Primitive):
|
|
3823
|
+
r"""
|
|
3824
|
+
Calculates the gradient of WKV operation.
|
|
3825
|
+
|
|
3826
|
+
Supported Platforms:
|
|
3827
|
+
``Ascend``
|
|
3828
|
+
"""
|
|
3829
|
+
|
|
3830
|
+
@prim_attr_register
|
|
3831
|
+
def __init__(self):
|
|
3832
|
+
"""Initialize WKVGrad."""
|
|
3833
|
+
self.init_prim_io_names(inputs=["time_first", "time_decay", "key", "value", "gy"],
|
|
3834
|
+
outputs=["gw", "gu", "gk", "gv"])
|
|
3835
|
+
|
|
3836
|
+
|
|
3837
|
+
class FlashAttentionScoreGrad(Primitive):
|
|
3838
|
+
r"""
|
|
3839
|
+
Calculates the gradient of FlashAttentionScore operation.
|
|
3840
|
+
.. warning::
|
|
3841
|
+
This is an experimental API that is subject to change or deletion.
|
|
3842
|
+
|
|
3843
|
+
Supported Platforms:
|
|
3844
|
+
``Ascend``
|
|
3845
|
+
"""
|
|
3846
|
+
@prim_attr_register
|
|
3847
|
+
def __init__(self, head_num, keep_prob=1.0, scale_value=1.0, pre_tokens=65536, next_tokens=65536, inner_precise=1,
|
|
3848
|
+
input_layout='BSH'):
|
|
3849
|
+
"""Initialize FlashAttentionScoreGrad."""
|
|
3850
|
+
validator.check_value_type('head_num', head_num, [int], self.name)
|
|
3851
|
+
validator.check_value_type('keep_prob', keep_prob, [int, float], self.name)
|
|
3852
|
+
validator.check_float(keep_prob, 0.0, validator.GE, "keep_prob", self.name)
|
|
3853
|
+
validator.check_float(keep_prob, 1.0, validator.LE, "keep_prob", self.name)
|
|
3854
|
+
validator.check_value_type('scale_value', scale_value, [float], self.name)
|
|
3855
|
+
validator.check_value_type('pre_tokens', pre_tokens, [int], self.name)
|
|
3856
|
+
validator.check_value_type('next_tokens', next_tokens, [int], self.name)
|
|
3857
|
+
validator.check_value_type('inner_precise', inner_precise, [int], self.name)
|
|
3858
|
+
if inner_precise not in [0, 1]:
|
|
3859
|
+
raise ValueError(f"Attribute 'inner_precise' must be either 0 or 1, but got {inner_precise}")
|
|
3860
|
+
validator.check_value_type('input_layout', input_layout, [str], self.name)
|
|
3861
|
+
if input_layout not in ["BSH"]:
|
|
3862
|
+
raise ValueError(f"Attribute 'input_layout' must be either 'bsh' or 'sbh', but got {input_layout}")
|
|
3863
|
+
self.init_prim_io_names(inputs=['query', 'key', 'value', 'attn_mask', 'attention_in', 'softmax_max',
|
|
3864
|
+
'softmax_sum', 'dy', 'drop_mask', 'real_shift', "padding_mask", 'softmax_out'],
|
|
3865
|
+
outputs=['dq', 'dk', 'dv'])
|