mindspore 2.0.0a0__cp37-none-any.whl → 2.0.0rc1__cp37-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 +9064 -0
- mindspore/__init__.py +4 -2
- mindspore/_akg/akg/composite/build_module.py +11 -0
- mindspore/_akg/akg/config/repository_cuda.json +11 -0
- mindspore/_akg/akg/tvm/contrib/nvcc.py +4 -3
- mindspore/_c_dataengine.cpython-37m-aarch64-linux-gnu.so +0 -0
- mindspore/_c_expression.cpython-37m-aarch64-linux-gnu.so +0 -0
- mindspore/_c_mindrecord.cpython-37m-aarch64-linux-gnu.so +0 -0
- mindspore/_check_jit_forbidden_api.py +102 -0
- mindspore/_checkparam.py +1066 -1001
- mindspore/_extends/parallel_compile/akg_compiler/akg_process.py +4 -3
- mindspore/_extends/parallel_compile/akg_compiler/tbe_topi.py +50 -48
- mindspore/_extends/parallel_compile/akg_compiler/util.py +9 -4
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_adapter.py +4 -4
- mindspore/_extends/parallel_compile/tbe_compiler/tbe_helper.py +9 -4
- mindspore/_extends/parse/__init__.py +5 -3
- mindspore/_extends/parse/namespace.py +16 -1
- mindspore/_extends/parse/parser.py +107 -22
- mindspore/_extends/parse/resources.py +0 -7
- mindspore/_extends/parse/standard_method.py +885 -413
- mindspore/_mindspore_offline_debug.cpython-37m-aarch64-linux-gnu.so +0 -0
- mindspore/amp.py +52 -57
- mindspore/bin/cache_admin +0 -0
- mindspore/bin/cache_server +0 -0
- mindspore/boost/boost.py +2 -2
- mindspore/boost/boost_cell_wrapper.py +38 -20
- mindspore/boost/dim_reduce.py +3 -3
- mindspore/boost/group_loss_scale_manager.py +1 -1
- mindspore/common/__init__.py +4 -6
- mindspore/common/_decorator.py +2 -0
- mindspore/common/_register_for_adapter.py +55 -0
- mindspore/common/_stub_tensor.py +201 -0
- mindspore/common/_utils.py +41 -7
- mindspore/common/api.py +215 -141
- mindspore/common/dtype.py +8 -1
- mindspore/common/dump.py +2 -2
- mindspore/common/initializer.py +4 -2
- mindspore/common/jit_config.py +17 -13
- mindspore/common/mutable.py +33 -13
- mindspore/common/parameter.py +23 -21
- mindspore/common/seed.py +8 -24
- mindspore/common/sparse_tensor.py +62 -41
- mindspore/common/tensor.py +852 -1154
- mindspore/communication/__init__.py +2 -2
- mindspore/communication/_comm_helper.py +11 -4
- mindspore/communication/management.py +22 -21
- mindspore/config/op_info.config +501 -1008
- mindspore/config/super_bar_config.json +512 -0
- mindspore/context.py +201 -23
- mindspore/dataset/__init__.py +6 -6
- mindspore/dataset/audio/__init__.py +7 -7
- mindspore/dataset/audio/transforms.py +670 -30
- mindspore/dataset/audio/utils.py +47 -4
- mindspore/dataset/audio/validators.py +223 -1
- mindspore/dataset/callback/ds_callback.py +2 -2
- mindspore/dataset/core/config.py +210 -14
- mindspore/dataset/core/validator_helpers.py +2 -2
- mindspore/{parallel/nn/layers.py → dataset/debug/__init__.py} +7 -8
- mindspore/dataset/debug/debug_hook.py +65 -0
- mindspore/dataset/debug/pre_defined_hook.py +67 -0
- mindspore/dataset/engine/__init__.py +7 -3
- mindspore/dataset/engine/cache_client.py +1 -1
- mindspore/dataset/engine/datasets.py +322 -66
- mindspore/dataset/engine/datasets_audio.py +80 -76
- mindspore/dataset/engine/datasets_standard_format.py +51 -38
- mindspore/dataset/engine/datasets_text.py +232 -118
- mindspore/dataset/engine/datasets_user_defined.py +41 -17
- mindspore/dataset/engine/datasets_vision.py +746 -225
- mindspore/dataset/engine/graphdata.py +75 -10
- mindspore/dataset/engine/iterators.py +45 -5
- mindspore/dataset/engine/offload.py +48 -28
- mindspore/dataset/engine/validators.py +117 -8
- mindspore/dataset/text/__init__.py +6 -5
- mindspore/dataset/text/transforms.py +86 -3
- mindspore/dataset/text/utils.py +6 -4
- mindspore/dataset/text/validators.py +25 -0
- mindspore/dataset/transforms/__init__.py +3 -2
- mindspore/dataset/transforms/c_transforms.py +1 -1
- mindspore/dataset/transforms/transforms.py +2 -2
- mindspore/dataset/utils/__init__.py +2 -1
- mindspore/dataset/utils/line_reader.py +121 -0
- mindspore/dataset/vision/__init__.py +2 -3
- mindspore/dataset/vision/c_transforms.py +9 -9
- mindspore/dataset/vision/py_transforms.py +5 -5
- mindspore/dataset/vision/py_transforms_util.py +2 -0
- mindspore/dataset/vision/transforms.py +160 -161
- mindspore/dataset/vision/utils.py +3 -3
- mindspore/experimental/map_parameter.py +38 -26
- mindspore/include/OWNERS +0 -1
- mindspore/include/api/callback/callback.h +9 -13
- mindspore/include/api/callback/ckpt_saver.h +2 -2
- mindspore/include/api/callback/loss_monitor.h +2 -2
- mindspore/include/api/callback/lr_scheduler.h +5 -5
- mindspore/include/api/callback/time_monitor.h +2 -2
- mindspore/include/api/callback/train_accuracy.h +4 -6
- mindspore/include/api/cfg.h +19 -6
- mindspore/include/api/context.h +44 -9
- mindspore/include/api/delegate.h +1 -1
- mindspore/include/api/metrics/accuracy.h +2 -2
- mindspore/include/api/metrics/metrics.h +4 -3
- mindspore/include/api/model.h +9 -4
- mindspore/include/api/model_parallel_runner.h +2 -2
- mindspore/include/api/net.h +12 -11
- mindspore/include/api/serialization.h +19 -3
- mindspore/include/api/types.h +3 -3
- mindspore/include/dataset/constants.h +7 -0
- mindspore/include/dataset/text.h +59 -0
- mindspore/include/mindapi/base/type_id.h +1 -0
- mindspore/lib/libdnnl.so.2 +0 -0
- mindspore/lib/libicudata.so.69 +0 -0
- mindspore/lib/libicui18n.so.69 +0 -0
- mindspore/lib/libicuuc.so.69 +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/libmpi_collective.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/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 → libmindspore_ascend.so.2} +0 -0
- mindspore/log.py +1 -1
- mindspore/mindrecord/filereader.py +18 -0
- mindspore/mindrecord/filewriter.py +197 -34
- mindspore/mindrecord/shardreader.py +9 -0
- mindspore/mindrecord/shardwriter.py +1 -1
- mindspore/mindrecord/tools/cifar100_to_mr.py +3 -3
- mindspore/mindrecord/tools/cifar10_to_mr.py +3 -3
- mindspore/mindrecord/tools/csv_to_mr.py +3 -3
- mindspore/mindrecord/tools/imagenet_to_mr.py +16 -11
- mindspore/mindrecord/tools/mnist_to_mr.py +2 -2
- mindspore/mindrecord/tools/tfrecord_to_mr.py +6 -6
- mindspore/nn/__init__.py +0 -4
- mindspore/nn/cell.py +204 -132
- mindspore/nn/dynamic_lr.py +1 -1
- mindspore/nn/grad/cell_grad.py +7 -6
- mindspore/nn/layer/__init__.py +5 -4
- mindspore/nn/layer/activation.py +40 -89
- mindspore/nn/layer/basic.py +255 -624
- mindspore/nn/layer/channel_shuffle.py +7 -6
- mindspore/nn/layer/combined.py +1 -1
- mindspore/nn/layer/container.py +41 -4
- mindspore/nn/layer/conv.py +64 -28
- mindspore/nn/layer/dense.py +9 -8
- mindspore/nn/layer/embedding.py +27 -25
- mindspore/nn/layer/image.py +53 -46
- mindspore/nn/layer/math.py +97 -105
- mindspore/nn/layer/normalization.py +117 -86
- mindspore/nn/layer/padding.py +185 -95
- mindspore/nn/layer/pooling.py +817 -414
- mindspore/nn/layer/rnn_cells.py +10 -15
- mindspore/nn/layer/rnns.py +37 -38
- mindspore/nn/layer/thor_layer.py +11 -12
- mindspore/nn/layer/timedistributed.py +5 -5
- mindspore/nn/layer/transformer.py +701 -0
- mindspore/nn/learning_rate_schedule.py +8 -8
- mindspore/nn/loss/__init__.py +5 -4
- mindspore/nn/loss/loss.py +334 -199
- mindspore/nn/optim/ada_grad.py +6 -6
- mindspore/nn/optim/adadelta.py +2 -3
- mindspore/nn/optim/adafactor.py +4 -5
- mindspore/nn/optim/adam.py +126 -62
- mindspore/nn/optim/adamax.py +3 -4
- mindspore/nn/optim/adasum.py +6 -6
- mindspore/nn/optim/asgd.py +2 -2
- mindspore/nn/optim/ftrl.py +67 -38
- mindspore/nn/optim/lamb.py +4 -5
- mindspore/nn/optim/lars.py +2 -2
- mindspore/nn/optim/lazyadam.py +43 -4
- mindspore/nn/optim/momentum.py +6 -5
- mindspore/nn/optim/optimizer.py +3 -1
- mindspore/nn/optim/proximal_ada_grad.py +2 -2
- mindspore/nn/optim/rmsprop.py +1 -1
- mindspore/nn/optim/rprop.py +8 -9
- mindspore/nn/optim/sgd.py +19 -13
- mindspore/nn/optim/thor.py +10 -15
- mindspore/nn/probability/__init__.py +0 -2
- mindspore/nn/probability/bijector/bijector.py +4 -4
- mindspore/nn/probability/bijector/invert.py +1 -1
- mindspore/nn/probability/bijector/softplus.py +2 -2
- mindspore/nn/probability/bnn_layers/dense_variational.py +1 -1
- mindspore/nn/probability/bnn_layers/layer_distribution.py +2 -2
- mindspore/nn/probability/distribution/_utils/utils.py +9 -15
- mindspore/nn/probability/distribution/bernoulli.py +3 -3
- mindspore/nn/probability/distribution/beta.py +1 -1
- mindspore/nn/probability/distribution/categorical.py +5 -7
- mindspore/nn/probability/distribution/cauchy.py +3 -3
- mindspore/nn/probability/distribution/distribution.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -2
- mindspore/nn/probability/distribution/gamma.py +3 -3
- mindspore/nn/probability/distribution/geometric.py +1 -1
- mindspore/nn/probability/distribution/gumbel.py +3 -3
- mindspore/nn/probability/distribution/half_normal.py +15 -11
- mindspore/nn/probability/distribution/laplace.py +16 -13
- mindspore/nn/probability/distribution/logistic.py +2 -2
- mindspore/nn/probability/distribution/normal.py +1 -1
- mindspore/nn/probability/distribution/poisson.py +1 -1
- mindspore/nn/probability/distribution/student_t.py +20 -15
- mindspore/nn/probability/distribution/transformed_distribution.py +4 -4
- mindspore/nn/probability/distribution/uniform.py +2 -2
- mindspore/nn/reinforcement/_tensors_queue.py +3 -3
- mindspore/nn/reinforcement/tensor_array.py +2 -2
- mindspore/nn/sparse/sparse.py +2 -2
- mindspore/nn/wrap/cell_wrapper.py +27 -10
- mindspore/nn/wrap/grad_reducer.py +2 -2
- mindspore/nn/wrap/loss_scale.py +40 -24
- mindspore/numpy/array_creations.py +33 -22
- mindspore/numpy/array_ops.py +35 -30
- mindspore/numpy/logic_ops.py +6 -27
- mindspore/numpy/math_ops.py +22 -19
- mindspore/numpy/utils.py +1 -1
- mindspore/numpy/utils_const.py +108 -58
- mindspore/ops/_constants.py +0 -6
- mindspore/ops/_grad/__init__.py +2 -1
- mindspore/ops/_grad/grad_array_ops.py +86 -117
- mindspore/ops/_grad/grad_base.py +23 -1
- mindspore/ops/_grad/grad_clip_ops.py +2 -3
- mindspore/ops/_grad/grad_comm_ops.py +34 -24
- mindspore/ops/_grad/grad_implementations.py +9 -45
- mindspore/ops/_grad/grad_inner_ops.py +47 -4
- mindspore/ops/_grad/grad_math_ops.py +142 -117
- mindspore/ops/_grad/grad_nn_ops.py +71 -165
- mindspore/ops/_grad/grad_sequence_ops.py +296 -0
- mindspore/ops/_grad/grad_sparse.py +7 -6
- mindspore/ops/_grad_experimental/__init__.py +1 -0
- mindspore/ops/_grad_experimental/grad_array_ops.py +150 -15
- mindspore/ops/_grad_experimental/grad_image_ops.py +16 -7
- mindspore/ops/_grad_experimental/grad_inner_ops.py +1 -22
- mindspore/ops/_grad_experimental/grad_linalg_ops.py +4 -11
- mindspore/ops/_grad_experimental/grad_math_ops.py +210 -89
- mindspore/ops/_grad_experimental/grad_nn_ops.py +26 -22
- mindspore/ops/_grad_experimental/grad_scalar_ops.py +112 -0
- mindspore/ops/_grad_experimental/grad_sparse_ops.py +49 -8
- mindspore/ops/_op_impl/_custom_op/batch_matmul_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold.py +2 -2
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold2.py +2 -2
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold2_grad.py +2 -2
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold2_grad_reduce.py +4 -4
- mindspore/ops/_op_impl/_custom_op/batchnorm_fold_grad.py +3 -3
- mindspore/ops/_op_impl/_custom_op/cholesky_trsm_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/correction_mul.py +2 -2
- mindspore/ops/_op_impl/_custom_op/correction_mul_grad.py +2 -2
- mindspore/ops/_op_impl/_custom_op/dsd_back_impl.py +1 -5
- mindspore/ops/_op_impl/_custom_op/dsd_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel_grad.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel_grad_reduce.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perlayer.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perlayer_grad.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perlayer_grad_reduce.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fake_quant_perchannel.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fake_quant_perchannel_grad.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fake_quant_perlayer.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fake_quant_perlayer_grad.py +2 -2
- mindspore/ops/_op_impl/_custom_op/fused_abs_max1_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/img2col_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/matmul_cube_dense_left_impl.py +2 -2
- mindspore/ops/_op_impl/_custom_op/matmul_cube_dense_right_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/matmul_cube_fracz_left_cast_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/matmul_cube_fracz_right_mul_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/matmul_cube_impl.py +2 -2
- mindspore/ops/_op_impl/_custom_op/matmul_dds_impl.py +0 -4
- mindspore/ops/_op_impl/_custom_op/matrix_combine_impl.py +1 -1
- mindspore/ops/_op_impl/_custom_op/minmax_update_perchannel.py +2 -2
- mindspore/ops/_op_impl/_custom_op/minmax_update_perlayer.py +2 -2
- mindspore/ops/_op_impl/_custom_op/transpose02314_impl.py +1 -1
- mindspore/ops/_op_impl/aicpu/__init__.py +236 -4
- mindspore/ops/_op_impl/aicpu/abs.py +36 -0
- mindspore/ops/_op_impl/aicpu/{adaptive_avg_pool_2d_v1.py → adaptive_avg_pool_2d.py} +6 -5
- mindspore/ops/_op_impl/aicpu/adaptive_avg_pool_2d_grad.py +34 -0
- mindspore/ops/_op_impl/aicpu/add.py +43 -0
- mindspore/ops/_op_impl/aicpu/addcdiv.py +0 -32
- mindspore/ops/_op_impl/aicpu/addcmul.py +0 -84
- mindspore/ops/_op_impl/aicpu/affine_grid_grad.py +35 -0
- mindspore/ops/_op_impl/aicpu/batch_matmul.py +43 -43
- mindspore/ops/_op_impl/aicpu/bernoulli.py +48 -0
- mindspore/{compression/common/__init__.py → ops/_op_impl/aicpu/bessel_i0.py} +15 -8
- mindspore/ops/_op_impl/aicpu/channel_shuffle.py +40 -0
- mindspore/ops/_op_impl/aicpu/conj.py +11 -0
- mindspore/ops/_op_impl/aicpu/cumulative_logsumexp.py +0 -3
- mindspore/ops/_op_impl/aicpu/deformable_offsets.py +38 -0
- mindspore/ops/_op_impl/aicpu/deformable_offsets_grad.py +43 -0
- mindspore/ops/_op_impl/aicpu/{adaptive_avg_pool_2d_grad_v1.py → digamma.py} +7 -9
- mindspore/ops/_op_impl/aicpu/flatten.py +1 -0
- mindspore/ops/_op_impl/aicpu/fmax.py +36 -0
- mindspore/ops/_op_impl/aicpu/fmin.py +37 -0
- mindspore/ops/_op_impl/aicpu/fractional_max_pool3d_with_fixed_ksize.py +1 -1
- mindspore/ops/_op_impl/aicpu/fse_decode.py +43 -0
- mindspore/ops/_op_impl/aicpu/greater.py +41 -0
- mindspore/ops/_op_impl/aicpu/greater_equal.py +41 -0
- mindspore/ops/_op_impl/aicpu/index_put.py +50 -0
- mindspore/ops/_op_impl/aicpu/less.py +41 -0
- mindspore/{nn/probability/infer/variational/__init__.py → ops/_op_impl/aicpu/lgamma.py} +16 -10
- mindspore/ops/_op_impl/aicpu/mirror_pad.py +0 -4
- mindspore/ops/_op_impl/aicpu/mirror_pad_grad.py +0 -4
- mindspore/ops/_op_impl/aicpu/mul.py +3 -1
- mindspore/ops/_op_impl/aicpu/multinomial.py +14 -6
- mindspore/ops/_op_impl/aicpu/nllloss.py +38 -0
- mindspore/ops/_op_impl/aicpu/nllloss_grad.py +39 -0
- mindspore/ops/_op_impl/aicpu/ones_like.py +0 -2
- mindspore/ops/_op_impl/aicpu/polar.py +32 -0
- mindspore/ops/_op_impl/aicpu/polygamma.py +34 -0
- mindspore/ops/_op_impl/aicpu/quant_dtype_cast.py +40 -0
- mindspore/ops/_op_impl/aicpu/quantile.py +35 -0
- mindspore/ops/_op_impl/aicpu/ragged_tensor_to_sparse.py +73 -0
- mindspore/ops/_op_impl/aicpu/randperm_v2.py +41 -0
- mindspore/ops/_op_impl/aicpu/resize_bicubic.py +2 -8
- mindspore/ops/_op_impl/aicpu/resize_bicubic_grad.py +1 -1
- mindspore/ops/_op_impl/aicpu/resize_v2.py +68 -0
- mindspore/ops/_op_impl/aicpu/resize_v2_grad.py +68 -0
- mindspore/ops/_op_impl/aicpu/scatter_elements.py +4 -0
- mindspore/ops/_op_impl/aicpu/scatter_nd_update.py +2 -0
- mindspore/ops/_op_impl/aicpu/sequence_add.py +34 -0
- mindspore/ops/_op_impl/aicpu/sequence_add_offset.py +34 -0
- mindspore/ops/_op_impl/aicpu/sequence_addn.py +38 -0
- mindspore/ops/_op_impl/aicpu/smooth_l1_loss.py +35 -0
- mindspore/ops/_op_impl/aicpu/smooth_l1_loss_grad.py +37 -0
- mindspore/ops/_op_impl/aicpu/sparse_apply_adagrad_da.py +0 -24
- mindspore/ops/_op_impl/aicpu/sparse_cross.py +42 -0
- mindspore/ops/_op_impl/aicpu/sparse_slice.py +4 -0
- mindspore/ops/_op_impl/aicpu/sparse_slice_grad.py +6 -0
- mindspore/ops/_op_impl/aicpu/tensor_scatter_update.py +59 -0
- mindspore/ops/_op_impl/aicpu/trans_data.py +1 -0
- mindspore/ops/_op_impl/aicpu/tril_indices.py +34 -0
- mindspore/ops/_op_impl/aicpu/uniform.py +34 -0
- mindspore/ops/_op_impl/aicpu/uniform_candidate_sampler.py +1 -0
- mindspore/ops/_op_impl/aicpu/unique_consecutive.py +10 -2
- mindspore/ops/_op_impl/cpu/dynamic_shape.py +5 -1
- mindspore/ops/_op_impl/cpu/sparse_slice.py +4 -0
- mindspore/ops/_op_impl/cpu/sparse_slice_grad.py +6 -0
- mindspore/ops/_op_impl/cpu/tensor_shape.py +5 -1
- mindspore/ops/_op_impl/tbe/__init__.py +27 -611
- mindspore/ops/_op_impl/tbe/assign_add_ds.py +1 -0
- mindspore/ops/_op_impl/tbe/atomic_addr_clean.py +1 -1
- mindspore/ops/_op_impl/tbe/avg_pool_3d_grad.py +1 -1
- mindspore/ops/_op_impl/tbe/batch_matmul_ds.py +1 -0
- mindspore/ops/_op_impl/tbe/batch_to_space.py +1 -1
- mindspore/ops/_op_impl/tbe/batch_to_space_nd.py +1 -1
- mindspore/ops/_op_impl/tbe/bn_infer_grad.py +4 -2
- mindspore/ops/_op_impl/tbe/bn_training_update.py +0 -1
- mindspore/ops/_op_impl/tbe/bn_training_update_ds.py +0 -1
- mindspore/ops/_op_impl/tbe/broadcast_to_ds.py +6 -4
- mindspore/ops/_op_impl/tbe/cast.py +0 -2
- mindspore/ops/_op_impl/tbe/cast_ds.py +3 -3
- mindspore/ops/_op_impl/tbe/data_format_dim_map_ds.py +1 -0
- mindspore/ops/_op_impl/tbe/depthwise_conv2d.py +2 -2
- mindspore/ops/_op_impl/tbe/dynamic_atomic_addr_clean.py +1 -1
- mindspore/ops/_op_impl/tbe/gather_nd.py +1 -0
- mindspore/ops/_op_impl/tbe/{index_add.py → inplace_index_add.py} +3 -6
- mindspore/ops/_op_impl/tbe/matmul_ds.py +2 -0
- mindspore/ops/_op_impl/tbe/npu_clear_float_status_v2.py +35 -0
- mindspore/ops/_op_impl/tbe/npu_get_float_status_v2.py +35 -0
- mindspore/ops/_op_impl/tbe/scatter_mul.py +2 -0
- mindspore/ops/_op_impl/tbe/scatter_nd_add.py +0 -2
- mindspore/ops/_op_impl/tbe/space_to_batch.py +1 -1
- mindspore/ops/_op_impl/tbe/space_to_batch_nd.py +1 -1
- mindspore/ops/_op_impl/tbe/trans_data_ds.py +15 -5
- mindspore/ops/_register_for_op.py +1 -0
- mindspore/ops/_utils/__init__.py +1 -2
- mindspore/ops/_utils/utils.py +19 -40
- mindspore/ops/_vmap/vmap_array_ops.py +116 -38
- mindspore/ops/_vmap/vmap_base.py +16 -9
- mindspore/ops/_vmap/vmap_convolution_ops.py +7 -10
- mindspore/ops/_vmap/vmap_grad_math_ops.py +4 -4
- mindspore/ops/_vmap/vmap_grad_nn_ops.py +7 -5
- mindspore/ops/_vmap/vmap_image_ops.py +12 -5
- mindspore/ops/_vmap/vmap_math_ops.py +46 -5
- mindspore/ops/_vmap/vmap_nn_ops.py +15 -21
- mindspore/ops/_vmap/vmap_random_ops.py +1 -1
- mindspore/ops/bprop_mindir/AdaptiveAvgPool2D_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/AdaptiveMaxPool2D_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/AvgPool3D_bprop.mindir +150 -0
- mindspore/ops/bprop_mindir/AvgPool_bprop.mindir +66 -0
- mindspore/ops/bprop_mindir/BCEWithLogitsLoss_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/BatchNormGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/BiasAddGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/BinaryCrossEntropy_bprop.mindir +33 -0
- mindspore/ops/bprop_mindir/BroadcastTo_bprop.mindir +220 -106
- mindspore/ops/bprop_mindir/CTCLoss_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Conv2DBackpropFilter_bprop.mindir +240 -0
- mindspore/ops/bprop_mindir/Conv2DBackpropInput_bprop.mindir +247 -0
- mindspore/ops/bprop_mindir/Conv2DTranspose_bprop.mindir +247 -0
- mindspore/ops/bprop_mindir/Conv3DTranspose_bprop.mindir +315 -0
- mindspore/ops/bprop_mindir/Conv3D_bprop.mindir +278 -0
- mindspore/ops/bprop_mindir/DeformableOffsets_bprop.mindir +58 -0
- mindspore/ops/bprop_mindir/DepthwiseConv2dNative_bprop.mindir +138 -0
- 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 +22 -23
- mindspore/ops/bprop_mindir/DropoutGenMask_bprop.mindir +16 -17
- mindspore/ops/bprop_mindir/DropoutGrad_bprop.mindir +27 -0
- 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/Elu_bprop.mindir +16 -0
- mindspore/ops/bprop_mindir/EmbeddingLookup_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/ExpandDims_bprop.mindir +39 -41
- mindspore/ops/bprop_mindir/FastGeLU_bprop.mindir +16 -0
- mindspore/ops/bprop_mindir/Flatten_bprop.mindir +41 -43
- mindspore/ops/bprop_mindir/GatherNd_bprop.mindir +51 -57
- mindspore/ops/bprop_mindir/Gather_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/HSigmoid_bprop.mindir +16 -0
- mindspore/ops/bprop_mindir/HSwish_bprop.mindir +16 -0
- mindspore/ops/bprop_mindir/InstanceNorm_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/KLDivLoss_bprop.mindir +126 -0
- mindspore/ops/bprop_mindir/L2Loss_bprop.mindir +15 -0
- mindspore/ops/bprop_mindir/L2Normalize_bprop.mindir +30 -0
- mindspore/ops/bprop_mindir/LRN_bprop.mindir +43 -0
- mindspore/ops/bprop_mindir/LayerNormGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/LogSoftmax_bprop.mindir +23 -0
- mindspore/ops/bprop_mindir/MaxPool3DGradGrad_bprop.mindir +74 -0
- mindspore/ops/bprop_mindir/MaxPool3DGrad_bprop.mindir +74 -0
- mindspore/ops/bprop_mindir/MaxPool3D_bprop.mindir +75 -0
- mindspore/ops/bprop_mindir/MaxPoolGradGrad_bprop.mindir +65 -0
- mindspore/ops/bprop_mindir/MaxPoolWithArgmax_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/MirrorPad_bprop.mindir +27 -0
- mindspore/ops/bprop_mindir/Mish_bprop.mindir +35 -0
- mindspore/ops/bprop_mindir/MulNoNan_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/NLLLoss_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/OneHot_bprop.mindir +24 -25
- 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 +29 -0
- mindspore/ops/bprop_mindir/ROIAlign_bprop.mindir +82 -0
- mindspore/ops/bprop_mindir/ReLU6_bprop.mindir +16 -0
- mindspore/ops/bprop_mindir/ReLUV2_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/ReluGrad_bprop.mindir +18 -19
- mindspore/ops/bprop_mindir/Reshape_bprop.mindir +53 -53
- mindspore/ops/bprop_mindir/ResizeBilinear_bprop.mindir +29 -0
- mindspore/ops/bprop_mindir/ResizeNearestNeighbor_bprop.mindir +77 -85
- mindspore/ops/bprop_mindir/SeLU_bprop.mindir +21 -0
- mindspore/ops/bprop_mindir/SigmoidCrossEntropyWithLogits_bprop.mindir +21 -0
- mindspore/ops/bprop_mindir/SigmoidGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Sigmoid_bprop.mindir +16 -0
- mindspore/ops/bprop_mindir/SmoothL1Loss_bprop.mindir +36 -0
- mindspore/ops/bprop_mindir/SoftmaxCrossEntropyWithLogits_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Softplus_bprop.mindir +16 -0
- mindspore/ops/bprop_mindir/Softsign_bprop.mindir +33 -0
- mindspore/ops/bprop_mindir/SparseSoftmaxCrossEntropyWithLogits_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Squeeze_bprop.mindir +37 -39
- mindspore/ops/bprop_mindir/StridedSlice_bprop.mindir +70 -72
- mindspore/ops/bprop_mindir/TanhGrad_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/Tanh_bprop.mindir +66 -0
- mindspore/ops/bprop_mindir/Tile_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/TopK_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/TupleGetItem_bprop.mindir +17 -17
- mindspore/ops/bprop_mindir/UpsampleNearest3D_bprop.mindir +32 -0
- mindspore/ops/bprop_mindir/UpsampleTrilinear3D_bprop.mindir +38 -0
- mindspore/ops/bprop_mindir/generate_mindir.py +2 -0
- mindspore/ops/composite/__init__.py +7 -8
- mindspore/ops/composite/base.py +101 -47
- mindspore/ops/composite/math_ops.py +188 -158
- mindspore/ops/composite/multitype_ops/_compile_utils.py +415 -170
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +142 -87
- mindspore/ops/composite/multitype_ops/add_impl.py +6 -1
- mindspore/ops/composite/multitype_ops/div_impl.py +2 -3
- mindspore/ops/composite/multitype_ops/getitem_impl.py +31 -3
- mindspore/ops/composite/multitype_ops/greater_equal_impl.py +31 -0
- mindspore/ops/composite/multitype_ops/greater_impl.py +31 -0
- mindspore/ops/composite/multitype_ops/in_impl.py +9 -0
- mindspore/ops/composite/multitype_ops/less_equal_impl.py +31 -0
- mindspore/ops/composite/multitype_ops/less_impl.py +31 -0
- mindspore/ops/composite/multitype_ops/mul_impl.py +21 -5
- mindspore/ops/composite/multitype_ops/not_in_impl.py +9 -0
- mindspore/ops/composite/multitype_ops/ones_like_impl.py +2 -4
- mindspore/ops/composite/multitype_ops/setitem_impl.py +21 -3
- mindspore/ops/composite/multitype_ops/sub_impl.py +1 -1
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +35 -4
- mindspore/ops/function/__init__.py +152 -8
- mindspore/ops/function/array_func.py +2555 -674
- mindspore/ops/function/clip_func.py +209 -13
- mindspore/ops/function/debug_func.py +2 -2
- mindspore/ops/function/grad/__init__.py +2 -1
- mindspore/ops/function/grad/grad_func.py +147 -62
- mindspore/ops/function/image_func.py +54 -38
- mindspore/ops/function/linalg_func.py +167 -16
- mindspore/ops/function/math_func.py +4849 -1492
- mindspore/ops/function/nn_func.py +2573 -988
- mindspore/ops/function/other_func.py +115 -0
- mindspore/ops/function/parameter_func.py +3 -3
- mindspore/ops/function/random_func.py +790 -73
- mindspore/ops/function/sparse_func.py +98 -78
- mindspore/ops/function/sparse_unary_func.py +54 -53
- mindspore/ops/function/spectral_func.py +27 -24
- mindspore/ops/function/vmap_func.py +22 -2
- mindspore/ops/functional.py +97 -37
- mindspore/ops/op_info_register.py +70 -28
- mindspore/ops/operations/__init__.py +47 -14
- mindspore/ops/operations/_csr_ops.py +7 -7
- mindspore/ops/operations/_embedding_cache_ops.py +5 -5
- mindspore/ops/operations/_grad_ops.py +276 -187
- mindspore/ops/operations/_inner_ops.py +319 -113
- mindspore/ops/operations/_ms_kernel.py +10 -8
- mindspore/ops/operations/_ocr_ops.py +9 -9
- mindspore/ops/operations/_opaque_predicate_registry.py +4 -0
- mindspore/ops/operations/_quant_ops.py +137 -102
- mindspore/ops/operations/_rl_inner_ops.py +121 -60
- mindspore/ops/operations/_scalar_ops.py +466 -0
- mindspore/ops/operations/_sequence_ops.py +1004 -2
- mindspore/ops/operations/_tensor_array.py +10 -11
- mindspore/ops/operations/_thor_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +801 -466
- mindspore/ops/operations/comm_ops.py +51 -49
- mindspore/ops/operations/control_ops.py +2 -2
- mindspore/ops/operations/custom_ops.py +123 -44
- mindspore/ops/operations/debug_ops.py +24 -24
- mindspore/ops/operations/image_ops.py +240 -153
- mindspore/ops/operations/inner_ops.py +34 -50
- mindspore/ops/operations/linalg_ops.py +31 -9
- mindspore/ops/operations/math_ops.py +988 -757
- mindspore/ops/operations/nn_ops.py +965 -819
- mindspore/ops/operations/other_ops.py +51 -40
- mindspore/ops/operations/random_ops.py +204 -122
- mindspore/ops/operations/rl_ops.py +8 -9
- mindspore/ops/operations/sparse_ops.py +254 -93
- mindspore/ops/operations/spectral_ops.py +35 -3
- mindspore/ops/primitive.py +111 -9
- mindspore/parallel/_auto_parallel_context.py +189 -83
- mindspore/parallel/_offload_context.py +185 -0
- mindspore/parallel/_parallel_serialization.py +99 -7
- mindspore/parallel/_ps_context.py +9 -5
- mindspore/parallel/_recovery_context.py +1 -1
- mindspore/parallel/_tensor.py +7 -1
- mindspore/{nn/transformer → parallel/_transformer}/__init__.py +6 -6
- mindspore/{nn/transformer → parallel/_transformer}/layers.py +6 -37
- mindspore/{nn/transformer → parallel/_transformer}/loss.py +4 -7
- mindspore/{nn/transformer → parallel/_transformer}/moe.py +20 -16
- mindspore/{nn/transformer → parallel/_transformer}/op_parallel_config.py +3 -3
- mindspore/{nn/transformer → parallel/_transformer}/transformer.py +48 -111
- mindspore/parallel/_utils.py +1 -2
- mindspore/parallel/algo_parameter_config.py +1 -1
- mindspore/parallel/checkpoint_transform.py +37 -34
- mindspore/parallel/shard.py +17 -18
- mindspore/profiler/common/validator/validate_path.py +2 -2
- mindspore/profiler/envprofiling.py +69 -47
- mindspore/profiler/parser/ascend_timeline_generator.py +49 -42
- mindspore/profiler/parser/base_timeline_generator.py +49 -56
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +98 -78
- mindspore/profiler/parser/hwts_log_parser.py +1 -1
- mindspore/profiler/parser/integrator.py +15 -14
- mindspore/profiler/parser/minddata_analyzer.py +2 -2
- mindspore/profiler/parser/msadvisor_analyzer.py +12 -25
- mindspore/profiler/parser/msadvisor_parser.py +2 -4
- mindspore/profiler/parser/optime_parser.py +17 -18
- mindspore/profiler/parser/profiler_info.py +2 -1
- mindspore/profiler/profiling.py +218 -186
- mindspore/rewrite/__init__.py +3 -1
- mindspore/rewrite/api/node.py +1 -114
- mindspore/rewrite/api/node_type.py +3 -0
- mindspore/rewrite/api/pattern_engine.py +31 -1
- mindspore/rewrite/api/scoped_value.py +4 -4
- mindspore/rewrite/api/symbol_tree.py +3 -78
- mindspore/rewrite/api/tree_node_helper.py +1 -1
- mindspore/rewrite/ast_creator_register.py +1 -0
- mindspore/rewrite/ast_helpers/__init__.py +2 -2
- mindspore/rewrite/ast_helpers/ast_creator.py +1 -2
- mindspore/rewrite/ast_helpers/ast_finder.py +65 -0
- mindspore/rewrite/ast_helpers/ast_modifier.py +11 -3
- mindspore/rewrite/ast_transformers/flatten_recursive_stmt.py +18 -2
- mindspore/rewrite/namespace.py +0 -2
- mindspore/rewrite/node.py +157 -11
- mindspore/rewrite/parsers/assign_parser.py +231 -53
- mindspore/rewrite/parsers/class_def_parser.py +187 -109
- mindspore/rewrite/parsers/for_parser.py +24 -14
- mindspore/rewrite/parsers/function_def_parser.py +21 -4
- mindspore/rewrite/parsers/if_parser.py +6 -2
- mindspore/rewrite/sparsify/__init__.py +0 -0
- mindspore/rewrite/sparsify/sparse_transformer.py +448 -0
- mindspore/rewrite/sparsify/sparsify.py +109 -0
- mindspore/rewrite/sparsify/utils.py +173 -0
- mindspore/rewrite/symbol_tree.py +256 -133
- mindspore/rewrite/symbol_tree_builder.py +38 -1
- mindspore/run_check/_check_version.py +69 -63
- mindspore/run_check/run_check.py +2 -1
- mindspore/scipy/linalg.py +10 -114
- mindspore/scipy/ops.py +2 -2
- mindspore/scipy/ops_wrapper.py +1 -1
- mindspore/scipy/optimize/_bfgs.py +1 -1
- mindspore/scipy/optimize/_lagrange.py +200 -0
- mindspore/scipy/optimize/line_search.py +3 -2
- mindspore/scipy/optimize/minimize.py +41 -2
- mindspore/scipy/sparse/__init__.py +2 -2
- mindspore/scipy/sparse/linalg.py +4 -464
- mindspore/scipy/utils.py +1 -1
- mindspore/scipy/utils_const.py +7 -1
- mindspore/train/__init__.py +1 -1
- mindspore/train/_utils.py +28 -5
- mindspore/train/amp.py +273 -102
- mindspore/train/callback/_backup_and_restore.py +5 -5
- mindspore/train/callback/_callback.py +2 -2
- mindspore/train/callback/_checkpoint.py +3 -3
- mindspore/train/callback/_early_stop.py +3 -3
- mindspore/train/callback/_lambda_callback.py +2 -2
- mindspore/train/callback/_landscape.py +29 -31
- mindspore/train/callback/_loss_monitor.py +3 -3
- mindspore/train/callback/_on_request_exit.py +3 -3
- mindspore/train/callback/_reduce_lr_on_plateau.py +4 -4
- mindspore/train/callback/_summary_collector.py +23 -16
- mindspore/train/callback/_time_monitor.py +3 -3
- mindspore/train/checkpoint_pb2.py +68 -8
- mindspore/train/data_sink.py +15 -3
- mindspore/train/dataset_helper.py +10 -15
- mindspore/train/loss_scale_manager.py +8 -11
- mindspore/train/metrics/__init__.py +1 -1
- mindspore/train/metrics/bleu_score.py +1 -1
- mindspore/train/metrics/confusion_matrix.py +1 -1
- mindspore/train/metrics/cosine_similarity.py +1 -1
- mindspore/train/metrics/dice.py +2 -2
- mindspore/train/metrics/fbeta.py +1 -1
- mindspore/train/metrics/hausdorff_distance.py +4 -3
- mindspore/train/metrics/mean_surface_distance.py +2 -2
- mindspore/train/metrics/occlusion_sensitivity.py +1 -1
- mindspore/train/metrics/perplexity.py +1 -1
- mindspore/train/metrics/precision.py +1 -1
- mindspore/train/metrics/recall.py +1 -1
- mindspore/train/metrics/roc.py +2 -2
- mindspore/train/metrics/root_mean_square_surface_distance.py +2 -2
- mindspore/train/mind_ir_pb2.py +116 -37
- mindspore/train/model.py +45 -28
- mindspore/train/serialization.py +295 -188
- mindspore/train/summary/_summary_adapter.py +1 -1
- mindspore/train/summary/summary_record.py +43 -13
- mindspore/train/train_thor/convert_utils.py +2 -2
- mindspore/train/train_thor/dataset_helper.py +3 -3
- mindspore/version.py +1 -1
- {mindspore-2.0.0a0.dist-info → mindspore-2.0.0rc1.dist-info}/METADATA +3 -2
- {mindspore-2.0.0a0.dist-info → mindspore-2.0.0rc1.dist-info}/RECORD +648 -574
- mindspore/compression/__init__.py +0 -19
- mindspore/compression/common/constant.py +0 -124
- mindspore/compression/export/__init__.py +0 -19
- mindspore/compression/export/quant_export.py +0 -515
- mindspore/compression/quant/__init__.py +0 -28
- mindspore/compression/quant/qat.py +0 -634
- mindspore/compression/quant/quant_utils.py +0 -462
- mindspore/compression/quant/quantizer.py +0 -68
- mindspore/nn/layer/quant.py +0 -1868
- mindspore/nn/layer/rnn_utils.py +0 -90
- mindspore/nn/probability/dpn/__init__.py +0 -22
- mindspore/nn/probability/dpn/vae/__init__.py +0 -25
- mindspore/nn/probability/dpn/vae/cvae.py +0 -140
- mindspore/nn/probability/dpn/vae/vae.py +0 -124
- mindspore/nn/probability/infer/__init__.py +0 -22
- mindspore/nn/probability/infer/variational/elbo.py +0 -70
- mindspore/nn/probability/infer/variational/svi.py +0 -84
- mindspore/nn/probability/toolbox/__init__.py +0 -22
- mindspore/nn/probability/toolbox/anomaly_detection.py +0 -99
- mindspore/nn/probability/toolbox/uncertainty_evaluation.py +0 -364
- mindspore/nn/probability/transforms/__init__.py +0 -22
- mindspore/nn/probability/transforms/transform_bnn.py +0 -262
- mindspore/nn/probability/zhusuan/__init__.py +0 -18
- mindspore/nn/probability/zhusuan/framework/__init__.py +0 -18
- mindspore/nn/probability/zhusuan/framework/bn.py +0 -95
- mindspore/nn/probability/zhusuan/variational/__init__.py +0 -18
- mindspore/nn/probability/zhusuan/variational/elbo.py +0 -46
- mindspore/ops/_op_impl/aicpu/parallel_concat.py +0 -42
- mindspore/ops/_op_impl/tbe/gather_v2.py +0 -56
- mindspore/ops/bprop_mindir/AssignAdd_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/Cast_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/LogicalOr_bprop.mindir +0 -19
- mindspore/ops/bprop_mindir/MatMul_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/ReLU_bprop.mindir +0 -17
- mindspore/ops/bprop_mindir/Transpose_bprop.mindir +0 -0
- mindspore/ops/bprop_mindir/UpdateState_bprop.mindir +0 -15
- mindspore/ops/composite/array_ops.py +0 -241
- mindspore/ops/composite/clip_ops.py +0 -134
- mindspore/ops/composite/random_ops.py +0 -426
- mindspore/ops/composite/vmap_ops.py +0 -38
- mindspore/parallel/nn/__init__.py +0 -42
- mindspore/parallel/nn/loss.py +0 -22
- mindspore/parallel/nn/moe.py +0 -21
- mindspore/parallel/nn/op_parallel_config.py +0 -22
- mindspore/parallel/nn/transformer.py +0 -31
- {mindspore-2.0.0a0.dist-info → mindspore-2.0.0rc1.dist-info}/WHEEL +0 -0
- {mindspore-2.0.0a0.dist-info → mindspore-2.0.0rc1.dist-info}/entry_points.txt +0 -0
- {mindspore-2.0.0a0.dist-info → mindspore-2.0.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
"""Operators for sparse operators."""
|
|
20
20
|
|
|
21
|
-
from mindspore
|
|
21
|
+
from mindspore import _checkparam as validator
|
|
22
22
|
from mindspore.common import dtype as mstype
|
|
23
23
|
from mindspore.ops import signature as sig
|
|
24
24
|
from mindspore.ops.primitive import prim_attr_register, Primitive
|
|
@@ -57,9 +57,12 @@ class SparseDenseCwiseAdd(Primitive):
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
Supported Platforms:
|
|
60
|
-
``Ascend`` ``CPU``
|
|
60
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
61
61
|
|
|
62
62
|
Examples:
|
|
63
|
+
>>> from mindspore.common.tensor import Tensor
|
|
64
|
+
>>> from mindspore.common import dtype as ms
|
|
65
|
+
>>> from mindspore.ops.operations import sparse_ops as ops
|
|
63
66
|
>>> x1_indices = Tensor([[0, 0], [2, 2]], dtype=ms.int64)
|
|
64
67
|
>>> x1_values = Tensor([1, 2], dtype=ms.int32)
|
|
65
68
|
>>> x1_shape = Tensor([3, 3], dtype=ms.int64)
|
|
@@ -109,9 +112,12 @@ class SparseDenseCwiseMul(Primitive):
|
|
|
109
112
|
ValueError: If `x1_indices` proceed to cross the border the interview.
|
|
110
113
|
|
|
111
114
|
Supported Platforms:
|
|
112
|
-
``Ascend`` ``CPU``
|
|
115
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
113
116
|
|
|
114
117
|
Examples:
|
|
118
|
+
>>> from mindspore.common.tensor import Tensor
|
|
119
|
+
>>> from mindspore.common import dtype as ms
|
|
120
|
+
>>> from mindspore.ops.operations import sparse_ops as ops
|
|
115
121
|
>>> x1_indices = Tensor([[0, 0], [2, 2]], dtype=ms.int64)
|
|
116
122
|
>>> x1_values = Tensor([1, 2], dtype=ms.int32)
|
|
117
123
|
>>> x1_shape = Tensor([3, 3], dtype=ms.int64)
|
|
@@ -161,9 +167,12 @@ class SparseDenseCwiseDiv(Primitive):
|
|
|
161
167
|
ValueError: If `x1_indices` proceed to cross the border the interview.
|
|
162
168
|
|
|
163
169
|
Supported Platforms:
|
|
164
|
-
``Ascend`` ``
|
|
170
|
+
``Ascend`` ``GPU``
|
|
165
171
|
|
|
166
172
|
Examples:
|
|
173
|
+
>>> from mindspore.common.tensor import Tensor
|
|
174
|
+
>>> from mindspore.common import dtype as ms
|
|
175
|
+
>>> from mindspore.ops.operations import sparse_ops as ops
|
|
167
176
|
>>> x1_indices = Tensor([[0, 0], [2, 2]], dtype=ms.int64)
|
|
168
177
|
>>> x1_values = Tensor([4, 2], dtype=ms.int32)
|
|
169
178
|
>>> x1_shape = Tensor([3, 3], dtype=ms.int64)
|
|
@@ -183,10 +192,10 @@ class SparseDenseCwiseDiv(Primitive):
|
|
|
183
192
|
|
|
184
193
|
class SparseSlice(Primitive):
|
|
185
194
|
r"""
|
|
186
|
-
Slices a SparseTensor based on the
|
|
195
|
+
Slices a SparseTensor based on the `start` and `size`.
|
|
187
196
|
|
|
188
197
|
Inputs:
|
|
189
|
-
- **indices** (Tensor) - A 2D Tensor (N
|
|
198
|
+
- **indices** (Tensor) - A 2D Tensor of shape :math:`(N, R)`, the indices of the SparseTensor.
|
|
190
199
|
Support int64, each element value should be a non-negative int number.
|
|
191
200
|
The shape is :math:`(N, R)`.
|
|
192
201
|
- **values** (Tensor) - A 1D Tensor, represents the value corresponding to the position in the `indices`.
|
|
@@ -200,9 +209,10 @@ class SparseSlice(Primitive):
|
|
|
200
209
|
|
|
201
210
|
Outputs:
|
|
202
211
|
A `SparseTensor` objects resulting from splicing.
|
|
203
|
-
|
|
204
|
-
-
|
|
205
|
-
-
|
|
212
|
+
|
|
213
|
+
- \*y_indices: A Tensor of type int64.
|
|
214
|
+
- \*y_values: A Tensor. Has the same type as `values`.
|
|
215
|
+
- \*y_shape: A Tensor of type int64. Has the same size as `size`.
|
|
206
216
|
|
|
207
217
|
Raises:
|
|
208
218
|
TypeError: If the dtype of `indices`, `shape`, `start`, `size` are not int64.
|
|
@@ -214,7 +224,7 @@ class SparseSlice(Primitive):
|
|
|
214
224
|
ValueError: If the shape of `shape` is not corresponding to `size`.
|
|
215
225
|
|
|
216
226
|
Supported Platforms:
|
|
217
|
-
|
|
227
|
+
|
|
218
228
|
|
|
219
229
|
Examples:
|
|
220
230
|
>>> indices = Tensor(np.array([[0, 1], [1, 2], [1, 3], [2, 2]]).astype(np.int64))
|
|
@@ -277,7 +287,7 @@ class SparseSparseMaximum(Primitive):
|
|
|
277
287
|
ValueError: If the `x1_shape` and `x2_shape` mismatch with each other.
|
|
278
288
|
|
|
279
289
|
Supported Platforms:
|
|
280
|
-
``GPU`` ``CPU``
|
|
290
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
281
291
|
|
|
282
292
|
Examples:
|
|
283
293
|
>>> x1_indices = Tensor([[0, 1], [1, 2]])
|
|
@@ -295,6 +305,7 @@ class SparseSparseMaximum(Primitive):
|
|
|
295
305
|
>>> print(y_values)
|
|
296
306
|
[3. 4. 2.]
|
|
297
307
|
"""
|
|
308
|
+
|
|
298
309
|
@prim_attr_register
|
|
299
310
|
def __init__(self):
|
|
300
311
|
"""Initialize SparseSparseMaximum."""
|
|
@@ -331,13 +342,13 @@ class SetSize(Primitive):
|
|
|
331
342
|
parameter description.
|
|
332
343
|
|
|
333
344
|
Supported Platforms:
|
|
334
|
-
``CPU``
|
|
345
|
+
``Ascend`` ``CPU``
|
|
335
346
|
|
|
336
347
|
Examples:
|
|
337
348
|
>>> set_indices = Tensor(np.array([[0, 1], [1, 2]]).astype(np.int64))
|
|
338
349
|
>>> set_values = Tensor(np.array([1, 2]).astype(np.int64))
|
|
339
350
|
>>> set_shape = Tensor(np.array([3, 4]).astype(np.int64))
|
|
340
|
-
>>> setsize =
|
|
351
|
+
>>> setsize = ops.SetSize()
|
|
341
352
|
>>> out = setsize(set_indices, set_values, set_shape)
|
|
342
353
|
>>> print(out)
|
|
343
354
|
[1 1 0]
|
|
@@ -494,6 +505,7 @@ class SparseToDenseV2(Primitive):
|
|
|
494
505
|
"""Initialize SparseToDenseV2."""
|
|
495
506
|
self.add_prim_attr("max_length", 1000000)
|
|
496
507
|
self.validate_indices = validate_indices
|
|
508
|
+
validator.check_value_type('validate_indices', validate_indices, [bool], self.name)
|
|
497
509
|
self.add_prim_attr("validate_indices", self.validate_indices)
|
|
498
510
|
self.init_prim_io_names(
|
|
499
511
|
inputs=['indices', 'output_shape', 'values', 'default_value'], outputs=['output'])
|
|
@@ -525,7 +537,7 @@ class SparseSoftmax(Primitive):
|
|
|
525
537
|
ValueError: If the size of shape < 2.
|
|
526
538
|
|
|
527
539
|
Supported Platforms:
|
|
528
|
-
``GPU`` ``CPU``
|
|
540
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
529
541
|
|
|
530
542
|
Examples:
|
|
531
543
|
>>> indices = Tensor([[0,0], [0,3], [1,2], [1,5], [2,0], [2,5]])
|
|
@@ -549,11 +561,11 @@ class SparseTensorDenseAdd(Primitive):
|
|
|
549
561
|
|
|
550
562
|
Inputs:
|
|
551
563
|
- **x1_indices** (Tensor) - A 2-D Tensor, represents the position of the element in the sparse tensor.
|
|
552
|
-
Support int32, int64, each element value should be a non-negative int number. The shape is :math:`(n,
|
|
564
|
+
Support int32, int64, each element value should be a non-negative int number. The shape is :math:`(n, ndim)`.
|
|
553
565
|
- **x1_values** (Tensor) - A 1-D Tensor, represents the value corresponding to the position in the `indices`.
|
|
554
566
|
The shape should be :math:`(n,)`.
|
|
555
567
|
- **x1_shape** (tuple(int)) - A positive int tuple which specifies the shape of sparse tensor,
|
|
556
|
-
should have
|
|
568
|
+
should have ndim elements, represent sparse tensor shape is :math:`(ndim,)`.
|
|
557
569
|
- **x2** (Tensor) - A dense Tensor, the dtype is same as `values`.
|
|
558
570
|
|
|
559
571
|
Outputs:
|
|
@@ -626,9 +638,13 @@ class SparseTensorDenseMatmul(Primitive):
|
|
|
626
638
|
and shape of `dense` don't meet the parameter description.
|
|
627
639
|
|
|
628
640
|
Supported Platforms:
|
|
629
|
-
``CPU``
|
|
641
|
+
``GPU`` ``CPU``
|
|
630
642
|
|
|
631
643
|
Examples:
|
|
644
|
+
>>> import mindspore
|
|
645
|
+
>>> from mindspore import Tensor
|
|
646
|
+
>>> from mindspore.ops import operations as ops
|
|
647
|
+
>>> from mindspore.common import dtype as mstype
|
|
632
648
|
>>> indices = Tensor([[0, 1], [1, 2]], dtype=mindspore.int32)
|
|
633
649
|
>>> values = Tensor([1, 2], dtype=mindspore.float32)
|
|
634
650
|
>>> sparse_shape = (3, 4)
|
|
@@ -654,45 +670,6 @@ class SparseTensorDenseMatmul(Primitive):
|
|
|
654
670
|
validator.check_value_type("adjoint_dt", adjoint_dt, [bool], self.name)
|
|
655
671
|
self.set_const_input_indexes([2])
|
|
656
672
|
|
|
657
|
-
def __infer__(self, indices, values, sparse_shape, dense):
|
|
658
|
-
validator.check_tensor_dtype_valid('indices', indices['dtype'], [
|
|
659
|
-
mstype.int32, mstype.int64], self.name)
|
|
660
|
-
valid_types = (mstype.float16, mstype.float32,
|
|
661
|
-
mstype.float64, mstype.int32, mstype.int64)
|
|
662
|
-
args = {'values': values['dtype'], 'dense': dense['dtype']}
|
|
663
|
-
validator.check_tensors_dtypes_same_and_valid(
|
|
664
|
-
args, valid_types, self.name)
|
|
665
|
-
indices_shape = indices['shape']
|
|
666
|
-
if len(indices_shape) != 2 or indices_shape[1] != 2:
|
|
667
|
-
raise ValueError(f"For '{self.name}', the 'indices' must be a 2-D tensor and "
|
|
668
|
-
f"the second dimension length must be 2, but got 'indices' shape: {indices_shape}.")
|
|
669
|
-
values_shape = values['shape']
|
|
670
|
-
if len(values_shape) != 1 or values_shape[0] != indices_shape[0]:
|
|
671
|
-
raise ValueError(f"For '{self.name}', the 'values' must be a 1-D tensor and "
|
|
672
|
-
f"the first dimension length must be equal to the first dimension length of 'indices', "
|
|
673
|
-
f"but got 'indices' shape: {indices_shape}, 'values' shape: {values_shape}.")
|
|
674
|
-
a_shape = sparse_shape['value'][::-1] if self.adjoint_st else sparse_shape['value']
|
|
675
|
-
b_shape = dense['shape'][::-1] if self.adjoint_dt else dense['shape']
|
|
676
|
-
for i in a_shape:
|
|
677
|
-
if isinstance(i, bool) or not isinstance(i, int) or i <= 0:
|
|
678
|
-
raise ValueError(f"For '{self.name}', all elements in 'sparse_shape' must be "
|
|
679
|
-
f"positive int number, but got 'sparse_shape': {sparse_shape['value']}.")
|
|
680
|
-
if len(a_shape) != 2 or len(b_shape) != 2:
|
|
681
|
-
raise ValueError(f"For '{self.name}', both the length of 'sparse_shape' and the tensor "
|
|
682
|
-
f"rank of 'dense' must be equal to 2, but got the length of "
|
|
683
|
-
f"'sparse_shape': {len(a_shape)}, "
|
|
684
|
-
f"the tensor rank of 'dense': {len(b_shape)}.")
|
|
685
|
-
if a_shape[1] != b_shape[0]:
|
|
686
|
-
raise ValueError(f"For '{self.name}', the second dimension length of 'sparse_shape' must be equal to the "
|
|
687
|
-
f"first dimension length of 'dense', but got "
|
|
688
|
-
f"the tensor shape of 'sparse': {a_shape} and the tensor shape of 'dense': {b_shape}. "
|
|
689
|
-
f"Don't meet the condition for matmul")
|
|
690
|
-
out_shape = [a_shape[0], b_shape[1]]
|
|
691
|
-
out = {'shape': tuple(out_shape),
|
|
692
|
-
'dtype': values['dtype'],
|
|
693
|
-
'value': None}
|
|
694
|
-
return out
|
|
695
|
-
|
|
696
673
|
|
|
697
674
|
class CSRSparseMatrixToSparseTensor(Primitive):
|
|
698
675
|
"""
|
|
@@ -769,7 +746,7 @@ class DenseToCSRSparseMatrix(Primitive):
|
|
|
769
746
|
Converts a dense matrix(maybe batched) to its CSR sparse form.
|
|
770
747
|
|
|
771
748
|
.. warning::
|
|
772
|
-
This is an experimental
|
|
749
|
+
This is an experimental API that is subject to change or deletion.
|
|
773
750
|
|
|
774
751
|
Inputs:
|
|
775
752
|
- **dense_input** (Tensor) - A 2-D or 3-D Tensor. It represents the input dense matrix.
|
|
@@ -799,7 +776,7 @@ class DenseToCSRSparseMatrix(Primitive):
|
|
|
799
776
|
ValueError: If shape[1] of `indices` and rank of `dense_input` is not the same.
|
|
800
777
|
|
|
801
778
|
Supported Platforms:
|
|
802
|
-
|
|
779
|
+
|
|
803
780
|
|
|
804
781
|
Examples:
|
|
805
782
|
>>> x = Tensor([[[1., 0.], [0., 2.]]], dtype=mindspore.float32)
|
|
@@ -864,7 +841,7 @@ class DenseToDenseSetOperation(Primitive):
|
|
|
864
841
|
ValueError: If the value of attr set_operation is not a valid value.
|
|
865
842
|
|
|
866
843
|
Supported Platforms:
|
|
867
|
-
``CPU``
|
|
844
|
+
``Ascend`` ``CPU``
|
|
868
845
|
|
|
869
846
|
Examples:
|
|
870
847
|
>>> x1 = Tensor([[2, 2, 0], [2, 2, 1], [0, 2, 2]], dtype=mstype.int32)
|
|
@@ -898,7 +875,7 @@ class Sspaddmm(Primitive):
|
|
|
898
875
|
If `x1_shape` is :math:`(s0, s1)`, `x2_shpae` should be :math:`(s0, s2)`, the `x3_shape` should be :math:`(s2, s1)`.
|
|
899
876
|
|
|
900
877
|
.. warning::
|
|
901
|
-
This is an experimental
|
|
878
|
+
This is an experimental API that is subject to change or deletion.
|
|
902
879
|
|
|
903
880
|
.. math::
|
|
904
881
|
out =\beta * x1 + \alpha * (x2 @ x3),
|
|
@@ -961,7 +938,7 @@ class Sspaddmm(Primitive):
|
|
|
961
938
|
ValueError: If the shape of `alpha`, `beta` is not () or (1,).
|
|
962
939
|
|
|
963
940
|
Supported Platforms:
|
|
964
|
-
``GPU`` ``CPU``
|
|
941
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
965
942
|
|
|
966
943
|
Examples:
|
|
967
944
|
>>> x1_indices = Tensor(np.array([[0, 1], [0, 1]]), mstype.int64)
|
|
@@ -1033,7 +1010,7 @@ class SparseAddmm(Primitive):
|
|
|
1033
1010
|
RuntimeError: If `x1_shape`, shape of `x2`, shape of `x3` don't meet the parameter description.
|
|
1034
1011
|
|
|
1035
1012
|
Supported Platforms:
|
|
1036
|
-
``CPU``
|
|
1013
|
+
``GPU`` ``CPU``
|
|
1037
1014
|
|
|
1038
1015
|
Examples:
|
|
1039
1016
|
>>> indices = Tensor([[0, 1], [1, 2]], dtype=ms.int32)
|
|
@@ -1088,7 +1065,7 @@ class SparseConcat(Primitive):
|
|
|
1088
1065
|
Error: If input axis value is not in range [-rank, rank).
|
|
1089
1066
|
|
|
1090
1067
|
Supported Platforms:
|
|
1091
|
-
``CPU``
|
|
1068
|
+
``Ascend`` ``CPU``
|
|
1092
1069
|
|
|
1093
1070
|
Examples:
|
|
1094
1071
|
>>> indices0 = Tensor([[0, 1], [1, 2]], dtype=mstype.int64)
|
|
@@ -1106,6 +1083,7 @@ class SparseConcat(Primitive):
|
|
|
1106
1083
|
[3, 0],
|
|
1107
1084
|
[4, 1]]), Tensor(shape=[4], dtype=Int32, value= [1, 2, 3, 4]), Tensor(shape=[2], dtype=Int64, value= [6, 4]))
|
|
1108
1085
|
"""
|
|
1086
|
+
|
|
1109
1087
|
@prim_attr_register
|
|
1110
1088
|
def __init__(self, concat_dim=0):
|
|
1111
1089
|
"""Initialize SparseConcat."""
|
|
@@ -1251,7 +1229,7 @@ class SparseSegmentSqrtN(Primitive):
|
|
|
1251
1229
|
ValueError: If `indices` is out of range of x's first dimension.
|
|
1252
1230
|
|
|
1253
1231
|
Supported Platforms:
|
|
1254
|
-
``GPU`` ``CPU``
|
|
1232
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1255
1233
|
|
|
1256
1234
|
Examples:
|
|
1257
1235
|
>>> x = Tensor(np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]]).astype(np.float32))
|
|
@@ -1313,7 +1291,7 @@ class SparseSegmentSqrtNWithNumSegments(Primitive):
|
|
|
1313
1291
|
ValueError: If `indices` is out of range of x's first dimension.
|
|
1314
1292
|
|
|
1315
1293
|
Supported Platforms:
|
|
1316
|
-
``GPU`` ``CPU``
|
|
1294
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1317
1295
|
|
|
1318
1296
|
Examples:
|
|
1319
1297
|
>>> x = Tensor([[0, 1, 0, 0], [0, 1, 1, 0], [1, 0, 1, 0]], dtype=ms.float16)
|
|
@@ -1373,7 +1351,7 @@ class SparseMatrixNNZ(Primitive):
|
|
|
1373
1351
|
ValueError: If shape[0] of `x_dense_shape` is not 2 or 3.
|
|
1374
1352
|
|
|
1375
1353
|
Supported Platforms:
|
|
1376
|
-
``GPU`` ``CPU``
|
|
1354
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1377
1355
|
|
|
1378
1356
|
Examples:
|
|
1379
1357
|
>>> dense_shape = Tensor([2,3], dtype=mstype.int32)
|
|
@@ -1426,7 +1404,7 @@ class SparseFillEmptyRows(Primitive):
|
|
|
1426
1404
|
ValueError: If `sparse_shape`, shape of `indices` and shape of `values` don't meet the parameter description.
|
|
1427
1405
|
|
|
1428
1406
|
Supported Platforms:
|
|
1429
|
-
``Ascend`` ``CPU``
|
|
1407
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
1430
1408
|
|
|
1431
1409
|
Examples:
|
|
1432
1410
|
>>> indices = Tensor([[1, 0]], dtype=mstype.int64)
|
|
@@ -1487,9 +1465,12 @@ class SparseSegmentMeanWithNumSegments(Primitive):
|
|
|
1487
1465
|
ValueError: If `indices` is out of range of x's first dimension.
|
|
1488
1466
|
|
|
1489
1467
|
Supported Platforms:
|
|
1490
|
-
``CPU``
|
|
1468
|
+
``GPU`` ``CPU``
|
|
1491
1469
|
|
|
1492
1470
|
Examples:
|
|
1471
|
+
>>> from mindspore import Tensor
|
|
1472
|
+
>>> import mindspore as ms
|
|
1473
|
+
>>> import mindspore.ops.operations.sparse_ops as ops
|
|
1493
1474
|
>>> x = Tensor([[0, 2, 0, 0], [0, 1, 1, 0], [2, 0, 2, 0]], dtype=ms.float16)
|
|
1494
1475
|
>>> indices = Tensor([0, 2, 1], dtype=ms.int32)
|
|
1495
1476
|
>>> segment_ids = Tensor([0, 0, 2], dtype=ms.int32)
|
|
@@ -1548,7 +1529,7 @@ class SparseAdd(Primitive):
|
|
|
1548
1529
|
TypeError: If (x1_values/x2_values)'s type is not matched with thresh's type.
|
|
1549
1530
|
|
|
1550
1531
|
Supported Platforms:
|
|
1551
|
-
``
|
|
1532
|
+
``GPU`` ``CPU``
|
|
1552
1533
|
|
|
1553
1534
|
Examples:
|
|
1554
1535
|
>>> from mindspore import Tensor
|
|
@@ -1568,6 +1549,7 @@ class SparseAdd(Primitive):
|
|
|
1568
1549
|
Tensor(shape=[4], dtype=Int32, value=[3, 1, 4, 2]),
|
|
1569
1550
|
Tensor(shape=[2], dtype=Int64, value=[3, 4]))
|
|
1570
1551
|
"""
|
|
1552
|
+
|
|
1571
1553
|
@prim_attr_register
|
|
1572
1554
|
def __init__(self):
|
|
1573
1555
|
self.init_prim_io_names(
|
|
@@ -1581,7 +1563,7 @@ class SparseMatrixSoftmax(Primitive):
|
|
|
1581
1563
|
Calculates the softmax of a CSRTensorMatrix.
|
|
1582
1564
|
|
|
1583
1565
|
.. warning::
|
|
1584
|
-
This is an experimental
|
|
1566
|
+
This is an experimental API that is subject to change or deletion.
|
|
1585
1567
|
|
|
1586
1568
|
Args:
|
|
1587
1569
|
dtype (dtype.Number) - The valid data type. Only constant value is allowed.
|
|
@@ -1675,7 +1657,7 @@ class CSRSparseMatrixToDense(Primitive):
|
|
|
1675
1657
|
ValueError: If shape[0] of `x_dense_shape` is not 2 or 3.
|
|
1676
1658
|
|
|
1677
1659
|
Supported Platforms:
|
|
1678
|
-
``CPU``
|
|
1660
|
+
``Ascend`` ``CPU``
|
|
1679
1661
|
|
|
1680
1662
|
Examples:
|
|
1681
1663
|
>>> dense_shape = Tensor([2, 2], dtype=mindspore.int32)
|
|
@@ -1754,7 +1736,7 @@ class SparseMatrixTranspose(Primitive):
|
|
|
1754
1736
|
TypeError: The input data should have the correct CSR form.
|
|
1755
1737
|
|
|
1756
1738
|
Supported Platforms:
|
|
1757
|
-
``
|
|
1739
|
+
``Ascend`` ``CPU``
|
|
1758
1740
|
|
|
1759
1741
|
Examples:
|
|
1760
1742
|
>>> from mindspore.ops import operations as ops
|
|
@@ -1776,6 +1758,7 @@ class SparseMatrixTranspose(Primitive):
|
|
|
1776
1758
|
>>> print(output[4])
|
|
1777
1759
|
[99.]
|
|
1778
1760
|
"""
|
|
1761
|
+
|
|
1779
1762
|
@prim_attr_register
|
|
1780
1763
|
def __init__(self, conjugate=False):
|
|
1781
1764
|
"""Initialize SparseMatrixTranspose"""
|
|
@@ -2093,7 +2076,7 @@ class SparseMatrixMatMul(Primitive):
|
|
|
2093
2076
|
ValueError: If shape[0]-1 of `x1_batch_pointers` and shape[0] of `x2_dense` are not the same.
|
|
2094
2077
|
|
|
2095
2078
|
Supported Platforms:
|
|
2096
|
-
``
|
|
2079
|
+
``CPU``
|
|
2097
2080
|
|
|
2098
2081
|
Examples:
|
|
2099
2082
|
>>> x1_dense_shape = Tensor([4, 5], dtype=ms.int32)
|
|
@@ -2199,6 +2182,7 @@ class SparseMatrixAdd(Primitive):
|
|
|
2199
2182
|
Tensor(shape=[2], dtype=Int32, values = [0, 1]),
|
|
2200
2183
|
Tensor(shape=[2], dtype=Float32, values = [2.0, 4.0]))
|
|
2201
2184
|
"""
|
|
2185
|
+
|
|
2202
2186
|
@prim_attr_register
|
|
2203
2187
|
def __init__(self):
|
|
2204
2188
|
'''Initialize for SparseMatrixAdd'''
|
|
@@ -2244,6 +2228,7 @@ class SparseSplit(Primitive):
|
|
|
2244
2228
|
Supported Platforms:
|
|
2245
2229
|
|
|
2246
2230
|
"""
|
|
2231
|
+
|
|
2247
2232
|
@prim_attr_register
|
|
2248
2233
|
def __init__(self, num_split=1):
|
|
2249
2234
|
"""Initialize SparseSplit."""
|
|
@@ -2379,6 +2364,7 @@ class SparseReshape(Primitive):
|
|
|
2379
2364
|
>>> print(y_shape)
|
|
2380
2365
|
[9 4]
|
|
2381
2366
|
"""
|
|
2367
|
+
|
|
2382
2368
|
@prim_attr_register
|
|
2383
2369
|
def __init__(self):
|
|
2384
2370
|
"""Initialize SparseReshape."""
|
|
@@ -2421,8 +2407,8 @@ class SparseCountSparseOutput(Primitive):
|
|
|
2421
2407
|
ValueError: If number of values does not match first dimension of indices
|
|
2422
2408
|
ValueError: If number of dense_shape dimensions does not match second dimension of indices
|
|
2423
2409
|
ValueError: If num dim of dense_shape is < 1
|
|
2424
|
-
|
|
2425
|
-
|
|
2410
|
+
RuntimeError: If number of weights is not equal to number of values
|
|
2411
|
+
RuntimeError: If indexes are not in bounds of the dense shape
|
|
2426
2412
|
|
|
2427
2413
|
Examples:
|
|
2428
2414
|
>>> from mindspore.ops.operations.sparse_ops import SparseCountSparseOutput
|
|
@@ -2443,6 +2429,7 @@ class SparseCountSparseOutput(Primitive):
|
|
|
2443
2429
|
``CPU``
|
|
2444
2430
|
|
|
2445
2431
|
"""
|
|
2432
|
+
|
|
2446
2433
|
@prim_attr_register
|
|
2447
2434
|
def __init__(self, binary_output=False, minlength=-1, maxlength=-1):
|
|
2448
2435
|
self.init_prim_io_names(
|
|
@@ -2495,16 +2482,16 @@ class DenseToSparseSetOperation(Primitive):
|
|
|
2495
2482
|
``Ascend`` ``CPU``
|
|
2496
2483
|
|
|
2497
2484
|
Examples:
|
|
2498
|
-
>>>
|
|
2499
|
-
>>>
|
|
2500
|
-
>>>
|
|
2501
|
-
>>>
|
|
2502
|
-
>>>
|
|
2503
|
-
>>>
|
|
2485
|
+
>>> from mindspore.ops.operations.sparse_ops import DenseToSparseSetOperation
|
|
2486
|
+
>>> x1 = Tensor([[1, 2], [3, 0], [1, 5]], dtype=ms.int64)
|
|
2487
|
+
>>> x2_indices = Tensor([[0, 1], [0, 2], [1, 2]], dtype=ms.int64)
|
|
2488
|
+
>>> x2_values = Tensor([5, 1, 7],dtype=ms.int64)
|
|
2489
|
+
>>> x2_shape = Tensor([3, 3], dtype=ms.int64)
|
|
2490
|
+
>>> dense_to_sparse_set_operation = DenseToSparseSetOperation(set_operation='intersection')
|
|
2491
|
+
>>> out = dense_to_sparse_set_operation(x1, x2_indices, x2_values, x2_shape)
|
|
2504
2492
|
>>> print(out)
|
|
2505
|
-
(Tensor(shape=[
|
|
2506
|
-
|
|
2507
|
-
Tensor(shape=[2], dtype=Int64, value= [3, 2]))
|
|
2493
|
+
(Tensor(shape=[1, 2], dtype=Int64, value=
|
|
2494
|
+
[[0, 0]]), Tensor(shape=[1], dtype=Int64, value= [1]), Tensor(shape=[2], dtype=Int64, value= [3, 1]))
|
|
2508
2495
|
"""
|
|
2509
2496
|
|
|
2510
2497
|
@prim_attr_register
|
|
@@ -2535,11 +2522,12 @@ class RaggedTensorToTensor(Primitive):
|
|
|
2535
2522
|
Inputs:
|
|
2536
2523
|
- **shape** (Tensor) - A 1-D `Tensor`. Must be one of the following types: `int64`, `int32`.
|
|
2537
2524
|
The desired shape of the output tensor.
|
|
2538
|
-
- **values** (Tensor) - A 1-D `Tensor` representing the values of the ragged tensor.
|
|
2525
|
+
- **values** (Tensor) - A 1-D or higher `Tensor` representing the values of the ragged tensor.
|
|
2539
2526
|
- **default_value** (Tensor) - A `Tensor` representing the default value of the ragged tensor.
|
|
2540
2527
|
Must have the same type as `values` and less dimension than `values`.
|
|
2541
2528
|
- **row_partition_tensors** (list(Tensor)) - A list of at least 1 `Tensor` objects with the same
|
|
2542
|
-
type in: `int64`, `int32`.
|
|
2529
|
+
type in: `int64`, `int32`. The row partition tensor is 0-D, 1-D, 1-D, when the row partition type is
|
|
2530
|
+
"FIRST_DIM_SIZE", "VALUE_ROWIDS", "ROW_SPLITS" respectively.
|
|
2543
2531
|
|
|
2544
2532
|
Outputs:
|
|
2545
2533
|
A `Tensor`. Has the same type as `values` and the shape is `shape`.
|
|
@@ -2548,20 +2536,17 @@ class RaggedTensorToTensor(Primitive):
|
|
|
2548
2536
|
TypeError: If the type of `shape`, `values` or `default_value` is not Tensor.
|
|
2549
2537
|
ValueError: If the dimension of `shape` or `values` is not 1.
|
|
2550
2538
|
ValueError: If the dimension of `default_value` is more than `values`.
|
|
2551
|
-
|
|
2539
|
+
ValueError: If the order or value of `row_partition_types` is not support.
|
|
2540
|
+
RuntimeError: If the value of `row_partition_tensors` is not in ascending order
|
|
2552
2541
|
when the `row_partition_types` is "ROW_SPLITS".
|
|
2553
2542
|
RuntimeError: If value rowid is not less than first dim size
|
|
2554
2543
|
when the `row_partition_types` is "FIRST_DIM_SIZE", "VALUE_ROWIDS".
|
|
2555
|
-
|
|
2556
|
-
RuntimeError: If the value of `row_partition_types` is not support.
|
|
2557
|
-
RuntimeError: If row partition size plus `values` rank is not equal to `shape` rank.
|
|
2544
|
+
ValueError: If row partition size plus `values` rank is not equal to `shape` rank.
|
|
2558
2545
|
|
|
2559
2546
|
Supported Platforms:
|
|
2560
2547
|
``CPU``
|
|
2561
2548
|
|
|
2562
2549
|
Examples:
|
|
2563
|
-
>>> from mindspore.common import dtype as mstype
|
|
2564
|
-
>>> from mindspore.common.tensor import Tensor
|
|
2565
2550
|
>>> from mindspore.ops.operations.sparse_ops import RaggedTensorToTensor
|
|
2566
2551
|
>>> shape = Tensor([4, 4], mstype.int32)
|
|
2567
2552
|
>>> values = Tensor([1, 2, 3, 4, 5, 6, 7, 8, 9], mstype.int64)
|
|
@@ -2582,6 +2567,182 @@ class RaggedTensorToTensor(Primitive):
|
|
|
2582
2567
|
@prim_attr_register
|
|
2583
2568
|
def __init__(self, row_partition_types):
|
|
2584
2569
|
"""Initialize RaggedTensorToTensor"""
|
|
2585
|
-
validator.check_value_type("row_partition_types", row_partition_types, [list], self.name)
|
|
2586
2570
|
self.init_prim_io_names(inputs=['shape', 'values', 'default_value', 'row_partition_tensors'],
|
|
2587
2571
|
outputs=['result'])
|
|
2572
|
+
validator.check_value_type("row_partition_types", row_partition_types, [list], self.name)
|
|
2573
|
+
|
|
2574
|
+
if not row_partition_types:
|
|
2575
|
+
raise ValueError(f"For {self.name}, row_partition_types cannot be empty.")
|
|
2576
|
+
|
|
2577
|
+
for i, item in enumerate(row_partition_types):
|
|
2578
|
+
validator.check_value_type(f"row_partition_types[{i}]", item, [str], self.name)
|
|
2579
|
+
|
|
2580
|
+
valid_values = ("ROW_SPLITS", "FIRST_DIM_SIZE", "VALUE_ROWIDS")
|
|
2581
|
+
if not set(row_partition_types).issubset(valid_values):
|
|
2582
|
+
diff = tuple(set(row_partition_types).difference(valid_values))
|
|
2583
|
+
raise ValueError(
|
|
2584
|
+
f"For {self.name}, row_partition_types only support {valid_values}, "
|
|
2585
|
+
f"but got {diff if len(diff) > 1 else repr(diff[0])}.")
|
|
2586
|
+
|
|
2587
|
+
first_element = valid_values[:2]
|
|
2588
|
+
if row_partition_types[0] not in first_element:
|
|
2589
|
+
raise ValueError(
|
|
2590
|
+
f"For {self.name}, the first element of row_partition_types must be in {first_element}, "
|
|
2591
|
+
f"but got '{row_partition_types[0]}'.")
|
|
2592
|
+
|
|
2593
|
+
if row_partition_types[0] == "FIRST_DIM_SIZE":
|
|
2594
|
+
if set(row_partition_types[1:]) != {"VALUE_ROWIDS"}:
|
|
2595
|
+
raise ValueError(
|
|
2596
|
+
f"For {self.name}, 'VALUE_ROWIDS' must be preceded by 'FIRST_DIM_SIZE' in row_partition_types.")
|
|
2597
|
+
else:
|
|
2598
|
+
if set(row_partition_types) != {"ROW_SPLITS"}:
|
|
2599
|
+
raise ValueError(
|
|
2600
|
+
f"For {self.name}, the each element of row_partition_types must be 'ROW_SPLITS' "
|
|
2601
|
+
f"when row_splits tensor.")
|
|
2602
|
+
|
|
2603
|
+
|
|
2604
|
+
class SparseCross(Primitive):
|
|
2605
|
+
"""
|
|
2606
|
+
Generates sparse cross from a list of sparse and dense tensors.
|
|
2607
|
+
|
|
2608
|
+
Args:
|
|
2609
|
+
hashed_output (bool): If true, returns the hash of the cross instead of the string. This will allow us
|
|
2610
|
+
avoiding string manipulations.
|
|
2611
|
+
num_buckets (int): An int that is >= 0. It is used if "hashed_output" is true.output = hashed_value%num_buckets
|
|
2612
|
+
if num_buckets > 0 else "hashed_value".
|
|
2613
|
+
hash_key (int): Specify the hash_key that will be used by the "FingerprintCat64" function to combine the
|
|
2614
|
+
crosses fingerprints.
|
|
2615
|
+
out_type (mindspore.dtype): The output data type. Defaults to "int64".
|
|
2616
|
+
internal_type (mindspore.dtype): An type int64.
|
|
2617
|
+
|
|
2618
|
+
Inputs:
|
|
2619
|
+
- **indices** (list(Tensor)) - A list of Tensor objects with type int64. 2-D.
|
|
2620
|
+
Indices of each input SparseTensor.
|
|
2621
|
+
- **values** (list(Tensor)) - A list of Tensor objects with types from: int64.
|
|
2622
|
+
1-D. values of each SparseTensor.
|
|
2623
|
+
- **shapes** (list(Tensor)) - A list with the same length as indices of Tensor objects with type int64.
|
|
2624
|
+
1-D. Shapes of each SparseTensor.
|
|
2625
|
+
- **dense_inputs** (list(Tensor)) - A list of Tensor objects with types from: int64.
|
|
2626
|
+
2-D. Columns represented by dense Tensor.
|
|
2627
|
+
|
|
2628
|
+
Outputs:
|
|
2629
|
+
- **output_indices** (Tensor) - A Tensor of type int64. 2-D. Indices of the concatenated SparseTensor.
|
|
2630
|
+
- **output_values** (Tensor) - A Tensor of type "out_type". 1-D.
|
|
2631
|
+
Non-empty values of the concatenated or hashed SparseTensor.
|
|
2632
|
+
- **output_shape** (Tensor) - A Tensor of type int64. 1-D. Shape of the concatenated SparseTensor.
|
|
2633
|
+
|
|
2634
|
+
Raises:
|
|
2635
|
+
TypeError: The indices shape rank is not equal to the shape rank.
|
|
2636
|
+
TypeError: The indices element number is not equal to the value element number.
|
|
2637
|
+
TypeError: The indices shape rank should be 2.
|
|
2638
|
+
TypeError: The denses shape rank should be 2.
|
|
2639
|
+
TypeError: The shapes rank should be 2.
|
|
2640
|
+
|
|
2641
|
+
Supported Platforms:
|
|
2642
|
+
``CPU``
|
|
2643
|
+
|
|
2644
|
+
Examples:
|
|
2645
|
+
>>> from mindspore.ops.operations.sparse_ops import SparseCross
|
|
2646
|
+
>>> indice1 = Tensor([[0,0],[1,0],[1,1]], dtype=mstype.int64)
|
|
2647
|
+
>>> value1 = Tensor([1, 2, 3], dtype=mstype.int64)
|
|
2648
|
+
>>> shape1 = Tensor([2, 2], dtype=mstype.int64)
|
|
2649
|
+
>>> dense1 = Tensor([[1],[2]], dtype=mstype.int64)
|
|
2650
|
+
>>> indice2 = Tensor([[0,0],[1,0],[1,1]], dtype=mstype.int64)
|
|
2651
|
+
>>> value2 = Tensor([1, 2, 3], dtype=mstype.int64)
|
|
2652
|
+
>>> shape2 = Tensor([2, 2], dtype=mstype.int64)
|
|
2653
|
+
>>> dense2 = Tensor([[1],[2]], dtype=mstype.int64)
|
|
2654
|
+
>>> indices = [indice1, indice2]
|
|
2655
|
+
>>> values = [value1, value2]
|
|
2656
|
+
>>> shapes = [shape1, shape2]
|
|
2657
|
+
>>> dense_inputs = [dense1, dense2]
|
|
2658
|
+
>>> hashed_output=True
|
|
2659
|
+
>>> hash_key= 2
|
|
2660
|
+
>>> out_type= mstype.int64
|
|
2661
|
+
>>> internal_type = mstype.int64
|
|
2662
|
+
>>> num_buckets=0
|
|
2663
|
+
>>> sparse_cross = SparseCross(hashed_output, hash_key, out_type, internal_type, num_buckets)
|
|
2664
|
+
>>> out = sparse_cross(indices, values, shapes, dense_inputs)
|
|
2665
|
+
>>> print(out)
|
|
2666
|
+
(Tensor(shape=[5, 2], dtype=Int64, value=
|
|
2667
|
+
[[0, 0],
|
|
2668
|
+
[1, 0],
|
|
2669
|
+
[1, 1],
|
|
2670
|
+
[1, 2],
|
|
2671
|
+
[1, 3]]), Tensor(shape=[5], dtype=Int64, value= [1350190460805457680, 6319552725219729347,
|
|
2672
|
+
4652439303631496997, 7670687697825594049, 174086171018132662]), Tensor(shape=[2], dtype=Int64, value= [2, 4]))
|
|
2673
|
+
"""
|
|
2674
|
+
|
|
2675
|
+
@prim_attr_register
|
|
2676
|
+
def __init__(self, hashed_output, hash_key, out_type, internal_type, num_buckets=0):
|
|
2677
|
+
"""Initialize SparseCross."""
|
|
2678
|
+
self.init_prim_io_names(inputs=["indices", "values", "shapes", "dense_inputs"],
|
|
2679
|
+
outputs=["output_indices", "output_values", "output_shape"])
|
|
2680
|
+
validator.check_value_type("hashed_output", hashed_output, [bool], self.name)
|
|
2681
|
+
validator.check_value_type("hash_key", hash_key, [int], self.name)
|
|
2682
|
+
validator.check_value_type("out_type", out_type, [mstype.Type], self.name)
|
|
2683
|
+
validator.check_value_type("internal_type", internal_type, [mstype.Type], self.name)
|
|
2684
|
+
validator.check_value_type("num_buckets", num_buckets, [int], self.name)
|
|
2685
|
+
|
|
2686
|
+
|
|
2687
|
+
class RaggedTensorToSparse(Primitive):
|
|
2688
|
+
r"""
|
|
2689
|
+
Converts a RaggedTensor into a SparseTensor with the same values.
|
|
2690
|
+
|
|
2691
|
+
Args:
|
|
2692
|
+
Tsplits(mindspore.dtype): A required attribute, the type of the `rt_nested_splits`. Default: `int64`.
|
|
2693
|
+
|
|
2694
|
+
Inputs:
|
|
2695
|
+
- **rt_nested_splits** (list(Tensor)) - A list of at least 1 `Tensor` objects with the same
|
|
2696
|
+
type in: `int64`, `int32`. The row_splits for the RaggedTensor.
|
|
2697
|
+
Ragged splits is in ascending order, first value of splits must be 0 and final value of splits
|
|
2698
|
+
must equal with the length of `rt_dense_values`.
|
|
2699
|
+
- **rt_dense_values** (Tensor) - A `Tensor`. The flat_values for the RaggedTensor. The rank of values
|
|
2700
|
+
must more than 0.
|
|
2701
|
+
|
|
2702
|
+
Outputs:
|
|
2703
|
+
- **sparse_indices** (Tensor) - A `Tensor` of type int64. Contains the indices of the output
|
|
2704
|
+
sparse tensor.
|
|
2705
|
+
- **sparse_values** (Tensor) - A `Tensor`. Has the same type as rt_dense_values.
|
|
2706
|
+
Contains the values of the output sparse tensor.
|
|
2707
|
+
- **sparse_dense_shape** (Tensor) - A `Tensor` of type int64. Contains the dense shape of the
|
|
2708
|
+
output sparse tensor.
|
|
2709
|
+
|
|
2710
|
+
Raises:
|
|
2711
|
+
TypeError: If the type of `Tsplits`, `rt_nested_splits` or `rt_dense_values` is not support.
|
|
2712
|
+
RuntimeError: If the order of `rt_nested_splits` is not support.
|
|
2713
|
+
RuntimeError: If the first value of `rt_nested_splits` is not 0.
|
|
2714
|
+
RuntimeError: If the final value of `rt_nested_splits` is not equal with the length of
|
|
2715
|
+
`rt_dense_values`.
|
|
2716
|
+
ValueError: If the rank of `rt_dense_values` is not more than 0.
|
|
2717
|
+
|
|
2718
|
+
Supported Platforms:
|
|
2719
|
+
|
|
2720
|
+
|
|
2721
|
+
Examples:
|
|
2722
|
+
>>> from mindspore.ops.operations.sparse_ops import RaggedTensorToSparse
|
|
2723
|
+
>>> rt_nested_splits = Tensor([0, 3, 3, 5, 6], mstype.int64)
|
|
2724
|
+
>>> rt_dense_values = Tensor([1, 2, 3, 4, 5, 6], mstype.int32)
|
|
2725
|
+
>>> rt_nested_splits_list = []
|
|
2726
|
+
>>> rt_nested_splits_list.append(rt_nested_splits)
|
|
2727
|
+
>>> Tsplits = mstype.int64
|
|
2728
|
+
>>> ragged_tensor_to_sparse = RaggedTensorToSparse(Tsplits)
|
|
2729
|
+
>>> out = ragged_tensor_to_sparse(rt_nested_splits_list, rt_dense_values)
|
|
2730
|
+
>>> print(out)
|
|
2731
|
+
(Tensor(shape=[6, 2], dtype=Int64, value=
|
|
2732
|
+
[[0, 0],
|
|
2733
|
+
[0, 1],
|
|
2734
|
+
[0, 2],
|
|
2735
|
+
[2, 0],
|
|
2736
|
+
[2, 1],
|
|
2737
|
+
[3, 0]]),
|
|
2738
|
+
Tensor(shape=[6], dtype=Int32, value= [1, 2, 3, 4, 5, 6]),
|
|
2739
|
+
Tensor(shape=[2], dtype=Int64, value= [4, 3]))
|
|
2740
|
+
"""
|
|
2741
|
+
@prim_attr_register
|
|
2742
|
+
def __init__(self, Tsplits):
|
|
2743
|
+
"""Initialize RaggedTensorToSparse."""
|
|
2744
|
+
self.init_prim_io_names(inputs=['rt_nested_splits', 'rt_dense_values'],
|
|
2745
|
+
outputs=['sparse_indices', 'sparse_values', 'sparse_dense_shape'])
|
|
2746
|
+
validator.check_value_type("Tsplits", Tsplits, [mstype.Type], self.name)
|
|
2747
|
+
valid_values = {mstype.int64, mstype.int32}
|
|
2748
|
+
validator.check_type_name("Tsplits", Tsplits, valid_values, self.name)
|