mindspore 2.2.11__cp37-cp37m-manylinux1_x86_64.whl → 2.3.0rc1__cp37-cp37m-manylinux1_x86_64.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.

Files changed (1171) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/__init__.py +5 -4
  3. mindspore/_akg/akg/composite/build_module.py +155 -11
  4. mindspore/_akg/akg/config/repository.json +38 -0
  5. mindspore/_akg/akg/ms/info_version_adapt.py +29 -0
  6. mindspore/_akg/akg/topi/cpp/impl.py +1 -1
  7. mindspore/_akg/akg/tvm/_ffi/base.py +1 -1
  8. mindspore/_akg/akg/tvm/contrib/nvcc.py +4 -1
  9. mindspore/_akg/akg/utils/ascend_profilier/path_manager.py +2 -1
  10. mindspore/_akg/akg/utils/composite_op_helper.py +4 -2
  11. mindspore/_akg/akg/utils/dump_ascend_meta.py +2 -2
  12. mindspore/_akg/akg/utils/gen_random.py +14 -8
  13. mindspore/_akg/akg/utils/op_dsl.py +11 -0
  14. mindspore/_akg/akg/utils/tbe_codegen_utils.py +5 -5
  15. mindspore/_c_dataengine.cpython-37m-x86_64-linux-gnu.so +0 -0
  16. mindspore/_c_expression.cpython-37m-x86_64-linux-gnu.so +0 -0
  17. mindspore/_c_mindrecord.cpython-37m-x86_64-linux-gnu.so +0 -0
  18. mindspore/_checkparam.py +58 -0
  19. mindspore/_extends/builtin_operations.py +2 -1
  20. mindspore/_extends/graph_kernel/model/graph_parallel.py +16 -6
  21. mindspore/_extends/parallel_compile/akg_compiler/akg_process.py +3 -16
  22. mindspore/_extends/parallel_compile/akg_compiler/build_tbe_kernel.py +16 -4
  23. mindspore/_extends/parallel_compile/akg_compiler/compiler.py +1 -0
  24. mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +96 -0
  25. mindspore/_extends/parallel_compile/akg_compiler/tbe_topi.py +2 -1
  26. mindspore/_extends/parallel_compile/akg_compiler/util.py +5 -2
  27. mindspore/_extends/parse/__init__.py +18 -14
  28. mindspore/_extends/parse/compile_config.py +229 -0
  29. mindspore/_extends/parse/parser.py +155 -59
  30. mindspore/_extends/parse/resources.py +40 -7
  31. mindspore/_extends/parse/standard_method.py +124 -204
  32. mindspore/_extends/remote/kernel_build_server.py +2 -0
  33. mindspore/_mindspore_offline_debug.cpython-37m-x86_64-linux-gnu.so +0 -0
  34. mindspore/_profiler.py +30 -0
  35. mindspore/amp.py +24 -18
  36. mindspore/bin/cache_admin +0 -0
  37. mindspore/bin/cache_server +0 -0
  38. mindspore/boost/boost_cell_wrapper.py +1 -1
  39. mindspore/boost/group_loss_scale_manager.py +1 -1
  40. mindspore/common/__init__.py +3 -1
  41. mindspore/common/_jit_fallback_utils.py +2 -3
  42. mindspore/common/_register_for_adapter.py +7 -0
  43. mindspore/common/_stub_tensor.py +6 -1
  44. mindspore/common/_utils.py +5 -17
  45. mindspore/common/api.py +91 -48
  46. mindspore/common/auto_dynamic_shape.py +27 -14
  47. mindspore/common/dtype.py +5 -4
  48. mindspore/common/dump.py +5 -4
  49. mindspore/common/initializer.py +1 -1
  50. mindspore/common/jit_config.py +20 -11
  51. mindspore/common/lazy_inline.py +58 -17
  52. mindspore/common/mindir_util.py +12 -2
  53. mindspore/common/mutable.py +79 -14
  54. mindspore/common/parameter.py +19 -4
  55. mindspore/common/seed.py +9 -9
  56. mindspore/common/sparse_tensor.py +251 -18
  57. mindspore/common/symbol.py +122 -0
  58. mindspore/common/tensor.py +321 -435
  59. mindspore/communication/__init__.py +3 -3
  60. mindspore/communication/_comm_helper.py +5 -0
  61. mindspore/communication/management.py +56 -38
  62. mindspore/config/op_info.config +22 -54
  63. mindspore/context.py +192 -54
  64. mindspore/dataset/__init__.py +5 -5
  65. mindspore/dataset/audio/__init__.py +6 -6
  66. mindspore/dataset/audio/transforms.py +711 -158
  67. mindspore/dataset/callback/ds_callback.py +2 -2
  68. mindspore/dataset/engine/cache_client.py +2 -2
  69. mindspore/dataset/engine/datasets.py +95 -38
  70. mindspore/dataset/engine/datasets_audio.py +14 -14
  71. mindspore/dataset/engine/datasets_standard_format.py +33 -3
  72. mindspore/dataset/engine/datasets_text.py +38 -38
  73. mindspore/dataset/engine/datasets_user_defined.py +7 -7
  74. mindspore/dataset/engine/datasets_vision.py +75 -71
  75. mindspore/dataset/engine/offload.py +5 -7
  76. mindspore/dataset/engine/validators.py +1 -1
  77. mindspore/dataset/text/__init__.py +3 -3
  78. mindspore/dataset/text/transforms.py +408 -121
  79. mindspore/dataset/text/utils.py +9 -9
  80. mindspore/dataset/transforms/__init__.py +1 -1
  81. mindspore/dataset/transforms/transforms.py +261 -76
  82. mindspore/dataset/utils/browse_dataset.py +9 -9
  83. mindspore/dataset/vision/__init__.py +3 -3
  84. mindspore/dataset/vision/c_transforms.py +5 -5
  85. mindspore/dataset/vision/py_transforms_util.py +2 -2
  86. mindspore/dataset/vision/transforms.py +2264 -514
  87. mindspore/dataset/vision/utils.py +40 -9
  88. mindspore/dataset/vision/validators.py +7 -1
  89. mindspore/experimental/optim/__init__.py +12 -2
  90. mindspore/experimental/optim/adadelta.py +161 -0
  91. mindspore/experimental/optim/adagrad.py +168 -0
  92. mindspore/experimental/optim/adam.py +35 -34
  93. mindspore/experimental/optim/adamax.py +170 -0
  94. mindspore/experimental/optim/adamw.py +40 -16
  95. mindspore/experimental/optim/asgd.py +153 -0
  96. mindspore/experimental/optim/lr_scheduler.py +65 -125
  97. mindspore/experimental/optim/nadam.py +157 -0
  98. mindspore/experimental/optim/optimizer.py +15 -8
  99. mindspore/experimental/optim/radam.py +194 -0
  100. mindspore/experimental/optim/rmsprop.py +154 -0
  101. mindspore/experimental/optim/rprop.py +164 -0
  102. mindspore/experimental/optim/sgd.py +28 -19
  103. mindspore/hal/__init__.py +34 -0
  104. mindspore/hal/_ascend.py +57 -0
  105. mindspore/hal/_base.py +57 -0
  106. mindspore/hal/_cpu.py +56 -0
  107. mindspore/hal/_gpu.py +57 -0
  108. mindspore/hal/device.py +356 -0
  109. mindspore/hal/event.py +179 -0
  110. mindspore/hal/stream.py +337 -0
  111. mindspore/include/api/data_type.h +2 -2
  112. mindspore/include/api/dual_abi_helper.h +16 -3
  113. mindspore/include/api/model.h +1 -3
  114. mindspore/include/api/status.h +14 -0
  115. mindspore/include/c_api/model_c.h +173 -0
  116. mindspore/include/c_api/ms/base/types.h +1 -0
  117. mindspore/include/c_api/types_c.h +19 -0
  118. mindspore/include/dataset/execute.h +1 -3
  119. mindspore/include/mindapi/base/format.h +125 -23
  120. mindspore/include/mindapi/base/types.h +7 -0
  121. mindspore/lib/libdnnl.so.2 +0 -0
  122. mindspore/lib/libmindspore.so +0 -0
  123. mindspore/lib/libmindspore_backend.so +0 -0
  124. mindspore/lib/libmindspore_common.so +0 -0
  125. mindspore/lib/libmindspore_core.so +0 -0
  126. mindspore/lib/libmindspore_glog.so.0 +0 -0
  127. mindspore/lib/libmindspore_gpr.so.15 +0 -0
  128. mindspore/lib/libmindspore_grpc++.so.1 +0 -0
  129. mindspore/lib/libmindspore_grpc.so.15 +0 -0
  130. mindspore/lib/libmindspore_shared_lib.so +0 -0
  131. mindspore/lib/libmpi_adapter.so +0 -0
  132. mindspore/lib/libmpi_collective.so +0 -0
  133. mindspore/lib/libnnacl.so +0 -0
  134. mindspore/lib/libopencv_core.so.4.5 +0 -0
  135. mindspore/lib/libopencv_imgcodecs.so.4.5 +0 -0
  136. mindspore/lib/libopencv_imgproc.so.4.5 +0 -0
  137. mindspore/lib/libps_cache.so +0 -0
  138. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/config/ascend910/aic-ascend910-ops-info.json +2044 -154
  139. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/config/ascend910b/aic-ascend910b-ops-info.json +2044 -33
  140. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/build_tbe_kernel.py +529 -0
  141. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/compiler.py +56 -0
  142. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/custom.py +1109 -0
  143. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/get_file_path.py +36 -0
  144. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
  145. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/tbe_topi.py +556 -0
  146. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/vector_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
  147. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_cpu_kernels.so +0 -0
  148. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/config/cust_aicpu_kernel.json +6365 -1759
  149. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
  150. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_add_custom.h +49 -0
  151. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_decoder_kv_cache.h +59 -0
  152. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_prompt_kv_cache.h +59 -0
  153. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/lib/libcust_opapi.so +0 -0
  154. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend310p/aic-ascend310p-ops-info.json +52 -0
  155. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910/aic-ascend910-ops-info.json +232 -0
  156. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910b/aic-ascend910b-ops-info.json +232 -0
  157. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.cpp +81 -0
  158. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.py +134 -0
  159. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/decoder_kv_cache.cpp +192 -0
  160. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/decoder_kv_cache.py +134 -0
  161. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/prompt_kv_cache.cpp +274 -0
  162. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/prompt_kv_cache.py +134 -0
  163. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/lib/linux/x86_64/libcust_opmaster_rt2.0.so +0 -0
  164. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/liboptiling.so +0 -0
  165. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/inc/op_proto.h +39 -0
  166. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/lib/linux/x86_64/libcust_opsproto_rt2.0.so +0 -0
  167. mindspore/lib/plugin/ascend/libakg.so +0 -0
  168. mindspore/lib/plugin/ascend/libascend_collective.so +0 -0
  169. mindspore/lib/plugin/ascend/libdvpp_utils.so +0 -0
  170. mindspore/lib/plugin/ascend/libhccl_plugin.so +0 -0
  171. mindspore/lib/plugin/ascend/libmindspore_cpu_kernels.so +0 -0
  172. mindspore/lib/plugin/cpu/libakg.so +0 -0
  173. mindspore/lib/plugin/gpu/libcuda_ops.so.10 +0 -0
  174. mindspore/lib/plugin/gpu/libcuda_ops.so.11 +0 -0
  175. mindspore/lib/plugin/gpu10.1/libakg.so +0 -0
  176. mindspore/lib/plugin/gpu10.1/libnccl.so.2 +0 -0
  177. mindspore/lib/plugin/gpu10.1/libnvidia_collective.so +0 -0
  178. mindspore/lib/plugin/gpu11.1/libakg.so +0 -0
  179. mindspore/lib/plugin/gpu11.1/libnccl.so.2 +0 -0
  180. mindspore/lib/plugin/gpu11.1/libnvidia_collective.so +0 -0
  181. mindspore/lib/plugin/gpu11.6/libakg.so +0 -0
  182. mindspore/lib/plugin/gpu11.6/libnccl.so.2 +0 -0
  183. mindspore/lib/plugin/gpu11.6/libnvidia_collective.so +0 -0
  184. mindspore/lib/plugin/libmindspore_ascend.so.2 +0 -0
  185. mindspore/lib/plugin/libmindspore_gpu.so.10.1 +0 -0
  186. mindspore/lib/plugin/libmindspore_gpu.so.11.1 +0 -0
  187. mindspore/lib/plugin/libmindspore_gpu.so.11.6 +0 -0
  188. mindspore/mindrecord/__init__.py +5 -1
  189. mindspore/mindrecord/config.py +809 -0
  190. mindspore/mindrecord/filereader.py +25 -0
  191. mindspore/mindrecord/filewriter.py +74 -56
  192. mindspore/mindrecord/mindpage.py +40 -6
  193. mindspore/mindrecord/shardutils.py +3 -2
  194. mindspore/mindrecord/shardwriter.py +7 -0
  195. mindspore/mindrecord/tools/cifar100_to_mr.py +53 -66
  196. mindspore/mindrecord/tools/cifar10_to_mr.py +48 -63
  197. mindspore/mindrecord/tools/csv_to_mr.py +7 -17
  198. mindspore/mindrecord/tools/imagenet_to_mr.py +3 -8
  199. mindspore/mindrecord/tools/mnist_to_mr.py +11 -21
  200. mindspore/mindrecord/tools/tfrecord_to_mr.py +2 -10
  201. mindspore/multiprocessing/__init__.py +68 -0
  202. mindspore/nn/cell.py +86 -133
  203. mindspore/nn/dynamic_lr.py +2 -2
  204. mindspore/nn/layer/activation.py +80 -91
  205. mindspore/nn/layer/basic.py +4 -80
  206. mindspore/nn/layer/channel_shuffle.py +3 -16
  207. mindspore/nn/layer/container.py +3 -3
  208. mindspore/nn/layer/conv.py +71 -71
  209. mindspore/nn/layer/embedding.py +107 -46
  210. mindspore/nn/layer/image.py +4 -7
  211. mindspore/nn/layer/normalization.py +46 -38
  212. mindspore/nn/layer/padding.py +26 -39
  213. mindspore/nn/layer/pooling.py +13 -9
  214. mindspore/nn/layer/rnn_cells.py +5 -15
  215. mindspore/nn/layer/rnns.py +6 -5
  216. mindspore/nn/layer/thor_layer.py +1 -2
  217. mindspore/nn/layer/timedistributed.py +1 -1
  218. mindspore/nn/layer/transformer.py +52 -50
  219. mindspore/nn/learning_rate_schedule.py +6 -5
  220. mindspore/nn/loss/loss.py +44 -65
  221. mindspore/nn/optim/ada_grad.py +6 -4
  222. mindspore/nn/optim/adadelta.py +3 -1
  223. mindspore/nn/optim/adafactor.py +1 -1
  224. mindspore/nn/optim/adam.py +102 -181
  225. mindspore/nn/optim/adamax.py +4 -2
  226. mindspore/nn/optim/adasum.py +2 -2
  227. mindspore/nn/optim/asgd.py +4 -2
  228. mindspore/nn/optim/ftrl.py +31 -61
  229. mindspore/nn/optim/lamb.py +5 -3
  230. mindspore/nn/optim/lars.py +2 -2
  231. mindspore/nn/optim/lazyadam.py +6 -4
  232. mindspore/nn/optim/momentum.py +13 -25
  233. mindspore/nn/optim/optimizer.py +6 -3
  234. mindspore/nn/optim/proximal_ada_grad.py +4 -2
  235. mindspore/nn/optim/rmsprop.py +9 -3
  236. mindspore/nn/optim/rprop.py +4 -2
  237. mindspore/nn/optim/sgd.py +4 -2
  238. mindspore/nn/optim/thor.py +2 -2
  239. mindspore/nn/probability/distribution/_utils/custom_ops.py +2 -2
  240. mindspore/nn/probability/distribution/beta.py +2 -2
  241. mindspore/nn/probability/distribution/categorical.py +4 -6
  242. mindspore/nn/probability/distribution/cauchy.py +2 -2
  243. mindspore/nn/probability/distribution/exponential.py +1 -1
  244. mindspore/nn/probability/distribution/gumbel.py +2 -2
  245. mindspore/nn/probability/distribution/poisson.py +2 -2
  246. mindspore/nn/probability/distribution/uniform.py +2 -2
  247. mindspore/nn/reinforcement/_tensors_queue.py +13 -1
  248. mindspore/nn/wrap/__init__.py +2 -1
  249. mindspore/nn/wrap/cell_wrapper.py +33 -12
  250. mindspore/nn/wrap/grad_reducer.py +148 -8
  251. mindspore/nn/wrap/loss_scale.py +7 -7
  252. mindspore/numpy/__init__.py +2 -0
  253. mindspore/numpy/array_creations.py +2 -0
  254. mindspore/numpy/array_ops.py +1 -5
  255. mindspore/numpy/fft.py +431 -0
  256. mindspore/numpy/math_ops.py +53 -59
  257. mindspore/numpy/utils.py +3 -0
  258. mindspore/ops/__init__.py +7 -3
  259. mindspore/ops/_grad_experimental/grad_array_ops.py +4 -160
  260. mindspore/ops/_grad_experimental/grad_comm_ops.py +14 -18
  261. mindspore/ops/_grad_experimental/grad_inner_ops.py +8 -0
  262. mindspore/ops/_grad_experimental/grad_math_ops.py +92 -287
  263. mindspore/ops/_grad_experimental/grad_nn_ops.py +0 -53
  264. mindspore/ops/_grad_experimental/grad_quant_ops.py +3 -3
  265. mindspore/ops/_grad_experimental/grad_sparse.py +1 -1
  266. mindspore/ops/_grad_experimental/grad_sparse_ops.py +3 -3
  267. mindspore/ops/_op_impl/__init__.py +0 -1
  268. mindspore/ops/_op_impl/aicpu/__init__.py +1 -0
  269. mindspore/ops/_op_impl/aicpu/gamma.py +2 -0
  270. mindspore/ops/_op_impl/{cpu/concat.py → aicpu/generate_eod_mask.py} +16 -17
  271. mindspore/ops/_op_impl/aicpu/log_uniform_candidate_sampler.py +1 -3
  272. mindspore/ops/_op_impl/aicpu/poisson.py +2 -0
  273. mindspore/ops/_op_impl/cpu/__init__.py +1 -3
  274. mindspore/ops/_op_impl/cpu/adam.py +2 -2
  275. mindspore/ops/_op_impl/cpu/adam_weight_decay.py +3 -2
  276. mindspore/ops/_op_impl/cpu/maximum_grad.py +16 -14
  277. mindspore/ops/_op_impl/cpu/minimum_grad.py +8 -0
  278. mindspore/ops/_vmap/vmap_array_ops.py +137 -101
  279. mindspore/ops/_vmap/vmap_base.py +8 -1
  280. mindspore/ops/_vmap/vmap_grad_math_ops.py +95 -9
  281. mindspore/ops/_vmap/vmap_grad_nn_ops.py +102 -56
  282. mindspore/ops/_vmap/vmap_image_ops.py +70 -13
  283. mindspore/ops/_vmap/vmap_math_ops.py +74 -49
  284. mindspore/ops/_vmap/vmap_nn_ops.py +164 -89
  285. mindspore/ops/_vmap/vmap_other_ops.py +1 -1
  286. mindspore/ops/auto_generate/__init__.py +31 -0
  287. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +133 -0
  288. mindspore/ops/auto_generate/gen_arg_dtype_cast.py +248 -0
  289. mindspore/ops/auto_generate/gen_arg_handler.py +147 -0
  290. mindspore/ops/auto_generate/gen_extend_func.py +130 -0
  291. mindspore/ops/auto_generate/gen_ops_def.py +4786 -0
  292. mindspore/ops/auto_generate/gen_ops_prim.py +8335 -0
  293. mindspore/ops/auto_generate/pyboost_inner_prim.py +77 -0
  294. mindspore/ops/composite/__init__.py +5 -2
  295. mindspore/ops/composite/base.py +118 -17
  296. mindspore/ops/composite/math_ops.py +9 -48
  297. mindspore/ops/composite/multitype_ops/_compile_utils.py +166 -601
  298. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +15 -133
  299. mindspore/ops/composite/multitype_ops/add_impl.py +6 -0
  300. mindspore/ops/composite/multitype_ops/bitwise_and_impl.py +6 -0
  301. mindspore/ops/composite/multitype_ops/bitwise_or_impl.py +6 -0
  302. mindspore/ops/composite/multitype_ops/bitwise_xor_impl.py +6 -0
  303. mindspore/ops/composite/multitype_ops/div_impl.py +8 -0
  304. mindspore/ops/composite/multitype_ops/equal_impl.py +6 -0
  305. mindspore/ops/composite/multitype_ops/floordiv_impl.py +8 -0
  306. mindspore/ops/composite/multitype_ops/getitem_impl.py +6 -0
  307. mindspore/ops/composite/multitype_ops/greater_equal_impl.py +6 -0
  308. mindspore/ops/composite/multitype_ops/greater_impl.py +6 -0
  309. mindspore/ops/composite/multitype_ops/in_impl.py +8 -2
  310. mindspore/ops/composite/multitype_ops/left_shift_impl.py +6 -0
  311. mindspore/ops/composite/multitype_ops/less_equal_impl.py +6 -0
  312. mindspore/ops/composite/multitype_ops/less_impl.py +6 -0
  313. mindspore/ops/composite/multitype_ops/logic_not_impl.py +6 -0
  314. mindspore/ops/composite/multitype_ops/logical_and_impl.py +6 -0
  315. mindspore/ops/composite/multitype_ops/logical_or_impl.py +6 -0
  316. mindspore/ops/composite/multitype_ops/mod_impl.py +6 -0
  317. mindspore/ops/composite/multitype_ops/mul_impl.py +6 -0
  318. mindspore/ops/composite/multitype_ops/negative_impl.py +9 -3
  319. mindspore/ops/composite/multitype_ops/not_equal_impl.py +6 -0
  320. mindspore/ops/composite/multitype_ops/not_in_impl.py +6 -1
  321. mindspore/ops/composite/multitype_ops/ones_like_impl.py +2 -2
  322. mindspore/ops/composite/multitype_ops/pow_impl.py +6 -0
  323. mindspore/ops/composite/multitype_ops/right_shift_impl.py +6 -0
  324. mindspore/ops/composite/multitype_ops/setitem_impl.py +32 -21
  325. mindspore/ops/composite/multitype_ops/sub_impl.py +6 -0
  326. mindspore/ops/composite/multitype_ops/zeros_like_impl.py +6 -3
  327. mindspore/ops/deprecated.py +14 -3
  328. mindspore/ops/extend/__init__.py +46 -0
  329. mindspore/ops/extend/array_func.py +152 -0
  330. mindspore/ops/extend/math_func.py +76 -0
  331. mindspore/ops/{_op_impl/tbe/atomic_addr_clean.py → extend/nn_func.py} +5 -15
  332. mindspore/ops/function/__init__.py +19 -11
  333. mindspore/ops/function/array_func.py +248 -1436
  334. mindspore/ops/function/clip_func.py +12 -13
  335. mindspore/ops/function/debug_func.py +2 -5
  336. mindspore/ops/function/fft_func.py +31 -0
  337. mindspore/ops/function/grad/grad_func.py +24 -17
  338. mindspore/ops/function/image_func.py +27 -21
  339. mindspore/ops/function/linalg_func.py +30 -53
  340. mindspore/ops/function/math_func.py +450 -2356
  341. mindspore/ops/function/nn_func.py +470 -789
  342. mindspore/ops/function/other_func.py +4 -5
  343. mindspore/ops/function/parameter_func.py +6 -92
  344. mindspore/ops/function/random_func.py +24 -80
  345. mindspore/ops/function/sparse_unary_func.py +11 -18
  346. mindspore/ops/function/spectral_func.py +1 -1
  347. mindspore/ops/function/vmap_func.py +15 -14
  348. mindspore/ops/functional.py +56 -62
  349. mindspore/ops/op_info_register.py +22 -19
  350. mindspore/ops/operations/__init__.py +19 -19
  351. mindspore/ops/operations/_embedding_cache_ops.py +1 -1
  352. mindspore/ops/operations/_grad_ops.py +20 -723
  353. mindspore/ops/operations/_inner_ops.py +233 -286
  354. mindspore/ops/operations/_quant_ops.py +4 -4
  355. mindspore/ops/operations/_rl_inner_ops.py +1 -1
  356. mindspore/ops/operations/_scalar_ops.py +5 -480
  357. mindspore/ops/operations/_sequence_ops.py +4 -34
  358. mindspore/ops/operations/array_ops.py +100 -2481
  359. mindspore/ops/operations/comm_ops.py +38 -46
  360. mindspore/ops/operations/custom_ops.py +9 -9
  361. mindspore/ops/operations/debug_ops.py +101 -32
  362. mindspore/ops/operations/image_ops.py +3 -219
  363. mindspore/ops/operations/inner_ops.py +52 -38
  364. mindspore/ops/operations/linalg_ops.py +1 -49
  365. mindspore/{rewrite/ast_transformers → ops/operations/manually_defined}/__init__.py +11 -4
  366. mindspore/ops/operations/manually_defined/_inner.py +61 -0
  367. mindspore/ops/operations/manually_defined/ops_def.py +1391 -0
  368. mindspore/ops/operations/math_ops.py +752 -4588
  369. mindspore/ops/operations/nn_ops.py +380 -1750
  370. mindspore/ops/operations/other_ops.py +50 -42
  371. mindspore/ops/operations/random_ops.py +3 -50
  372. mindspore/ops/operations/sparse_ops.py +4 -4
  373. mindspore/ops/primitive.py +196 -96
  374. mindspore/ops/silent_check.py +162 -0
  375. mindspore/ops_generate/__init__.py +27 -0
  376. mindspore/ops_generate/arg_dtype_cast.py +248 -0
  377. mindspore/ops_generate/arg_handler.py +147 -0
  378. mindspore/ops_generate/gen_aclnn_implement.py +266 -0
  379. mindspore/ops_generate/gen_ops.py +1062 -0
  380. mindspore/ops_generate/gen_ops_inner_prim.py +129 -0
  381. mindspore/ops_generate/gen_pyboost_func.py +932 -0
  382. mindspore/ops_generate/gen_utils.py +188 -0
  383. mindspore/ops_generate/op_proto.py +138 -0
  384. mindspore/ops_generate/pyboost_utils.py +364 -0
  385. mindspore/ops_generate/template.py +238 -0
  386. mindspore/parallel/__init__.py +6 -4
  387. mindspore/parallel/_auto_parallel_context.py +28 -4
  388. mindspore/parallel/_cell_wrapper.py +16 -9
  389. mindspore/parallel/_cost_model_context.py +1 -1
  390. mindspore/parallel/_dp_allreduce_fusion.py +159 -159
  391. mindspore/parallel/_parallel_serialization.py +28 -12
  392. mindspore/parallel/_ps_context.py +1 -1
  393. mindspore/parallel/_recovery_context.py +1 -1
  394. mindspore/parallel/_tensor.py +22 -8
  395. mindspore/parallel/_transformer/__init__.py +1 -1
  396. mindspore/parallel/_transformer/layers.py +1 -1
  397. mindspore/parallel/_transformer/loss.py +1 -1
  398. mindspore/parallel/_transformer/moe.py +1 -1
  399. mindspore/parallel/_transformer/op_parallel_config.py +1 -1
  400. mindspore/parallel/_transformer/transformer.py +9 -9
  401. mindspore/parallel/_utils.py +131 -6
  402. mindspore/parallel/algo_parameter_config.py +6 -6
  403. mindspore/parallel/checkpoint_transform.py +156 -26
  404. mindspore/parallel/cluster/__init__.py +15 -0
  405. mindspore/parallel/cluster/process_entity/__init__.py +18 -0
  406. mindspore/parallel/cluster/process_entity/_api.py +345 -0
  407. mindspore/parallel/cluster/process_entity/_utils.py +116 -0
  408. mindspore/parallel/cluster/run.py +139 -0
  409. mindspore/parallel/mpi/__init__.py +1 -1
  410. mindspore/parallel/mpi/_mpi_config.py +1 -1
  411. mindspore/parallel/parameter_broadcast.py +152 -0
  412. mindspore/parallel/shard.py +99 -2
  413. mindspore/profiler/common/util.py +20 -0
  414. mindspore/profiler/envprofiling.py +1 -1
  415. mindspore/{_extends/parallel_compile/tbe_compiler → profiler/parser/ascend_analysis}/__init__.py +1 -1
  416. mindspore/profiler/parser/ascend_analysis/constant.py +66 -0
  417. mindspore/profiler/parser/ascend_analysis/file_manager.py +77 -0
  418. mindspore/profiler/parser/ascend_analysis/function_event.py +146 -0
  419. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +108 -0
  420. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +80 -0
  421. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +52 -0
  422. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +104 -0
  423. mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +86 -0
  424. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +59 -0
  425. mindspore/profiler/parser/ascend_cluster_generator.py +116 -0
  426. mindspore/profiler/parser/ascend_communicate_generator.py +314 -0
  427. mindspore/profiler/parser/ascend_flops_generator.py +27 -5
  428. mindspore/profiler/parser/ascend_fpbp_generator.py +8 -2
  429. mindspore/profiler/parser/ascend_hccl_generator.py +27 -279
  430. mindspore/profiler/parser/ascend_msprof_exporter.py +122 -118
  431. mindspore/profiler/parser/ascend_msprof_generator.py +67 -273
  432. mindspore/profiler/parser/ascend_op_generator.py +68 -27
  433. mindspore/profiler/parser/ascend_timeline_generator.py +292 -131
  434. mindspore/profiler/parser/base_timeline_generator.py +17 -3
  435. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +2 -1
  436. mindspore/profiler/parser/framework_parser.py +11 -4
  437. mindspore/profiler/parser/integrator.py +3 -1
  438. mindspore/profiler/parser/memory_usage_parser.py +8 -2
  439. mindspore/profiler/parser/minddata_analyzer.py +8 -2
  440. mindspore/profiler/parser/minddata_parser.py +1 -1
  441. mindspore/profiler/parser/msadvisor_analyzer.py +5 -3
  442. mindspore/profiler/parser/msadvisor_parser.py +10 -4
  443. mindspore/profiler/parser/profiler_info.py +5 -0
  444. mindspore/profiler/profiling.py +373 -171
  445. mindspore/rewrite/__init__.py +2 -13
  446. mindspore/rewrite/api/node.py +122 -36
  447. mindspore/rewrite/api/pattern_engine.py +2 -3
  448. mindspore/rewrite/api/scoped_value.py +16 -15
  449. mindspore/rewrite/api/symbol_tree.py +46 -30
  450. mindspore/rewrite/ast_helpers/__init__.py +3 -6
  451. mindspore/rewrite/ast_helpers/ast_converter.py +143 -0
  452. mindspore/rewrite/ast_helpers/ast_finder.py +48 -0
  453. mindspore/rewrite/ast_helpers/ast_flattener.py +268 -0
  454. mindspore/rewrite/ast_helpers/ast_modifier.py +160 -92
  455. mindspore/rewrite/common/__init__.py +1 -2
  456. mindspore/rewrite/common/config.py +24 -0
  457. mindspore/rewrite/common/{rewrite_elog.py → error_log.py} +39 -39
  458. mindspore/rewrite/{namer.py → common/namer.py} +63 -18
  459. mindspore/rewrite/common/namespace.py +118 -0
  460. mindspore/rewrite/node/__init__.py +5 -5
  461. mindspore/rewrite/node/call_function.py +23 -7
  462. mindspore/rewrite/node/cell_container.py +7 -3
  463. mindspore/rewrite/node/control_flow.py +53 -28
  464. mindspore/rewrite/node/node.py +212 -196
  465. mindspore/rewrite/node/node_manager.py +51 -22
  466. mindspore/rewrite/node/node_topological_manager.py +3 -23
  467. mindspore/rewrite/parsers/__init__.py +12 -0
  468. mindspore/rewrite/parsers/arguments_parser.py +8 -9
  469. mindspore/rewrite/parsers/assign_parser.py +635 -413
  470. mindspore/rewrite/parsers/attribute_parser.py +3 -4
  471. mindspore/rewrite/parsers/class_def_parser.py +107 -144
  472. mindspore/rewrite/parsers/constant_parser.py +5 -5
  473. mindspore/rewrite/parsers/container_parser.py +4 -6
  474. mindspore/rewrite/parsers/expr_parser.py +55 -0
  475. mindspore/rewrite/parsers/for_parser.py +31 -98
  476. mindspore/rewrite/parsers/function_def_parser.py +13 -5
  477. mindspore/rewrite/parsers/if_parser.py +28 -10
  478. mindspore/rewrite/parsers/module_parser.py +8 -182
  479. mindspore/rewrite/parsers/parser.py +1 -5
  480. mindspore/rewrite/parsers/parser_register.py +1 -1
  481. mindspore/rewrite/parsers/return_parser.py +5 -10
  482. mindspore/rewrite/parsers/while_parser.py +59 -0
  483. mindspore/rewrite/sparsify/utils.py +1 -1
  484. mindspore/rewrite/symbol_tree/__init__.py +20 -0
  485. mindspore/rewrite/{symbol_tree.py → symbol_tree/symbol_tree.py} +704 -185
  486. mindspore/rewrite/{symbol_tree_builder.py → symbol_tree/symbol_tree_builder.py} +8 -8
  487. mindspore/rewrite/{symbol_tree_dumper.py → symbol_tree/symbol_tree_dumper.py} +4 -4
  488. mindspore/run_check/_check_version.py +6 -14
  489. mindspore/run_check/run_check.py +1 -1
  490. mindspore/safeguard/rewrite_obfuscation.py +9 -19
  491. mindspore/scipy/__init__.py +2 -1
  492. mindspore/scipy/fft.py +133 -0
  493. mindspore/scipy/linalg.py +140 -55
  494. mindspore/scipy/ops.py +15 -71
  495. mindspore/scipy/ops_grad.py +5 -34
  496. mindspore/scipy/optimize/line_search.py +2 -2
  497. mindspore/scipy/optimize/minimize.py +1 -1
  498. mindspore/train/__init__.py +3 -2
  499. mindspore/train/_utils.py +178 -4
  500. mindspore/train/amp.py +167 -245
  501. mindspore/train/callback/_backup_and_restore.py +4 -4
  502. mindspore/train/callback/_callback.py +4 -4
  503. mindspore/train/callback/_checkpoint.py +47 -21
  504. mindspore/train/callback/_early_stop.py +2 -2
  505. mindspore/train/callback/_landscape.py +15 -10
  506. mindspore/train/callback/_loss_monitor.py +2 -2
  507. mindspore/train/callback/_on_request_exit.py +2 -2
  508. mindspore/train/callback/_reduce_lr_on_plateau.py +2 -2
  509. mindspore/train/callback/_summary_collector.py +13 -14
  510. mindspore/train/callback/_time_monitor.py +2 -2
  511. mindspore/train/data_sink.py +1 -1
  512. mindspore/train/dataset_helper.py +19 -4
  513. mindspore/train/loss_scale_manager.py +2 -2
  514. mindspore/train/metrics/accuracy.py +7 -7
  515. mindspore/train/metrics/confusion_matrix.py +8 -6
  516. mindspore/train/metrics/cosine_similarity.py +6 -4
  517. mindspore/train/metrics/error.py +2 -2
  518. mindspore/train/metrics/metric.py +3 -3
  519. mindspore/train/metrics/perplexity.py +2 -1
  520. mindspore/train/metrics/topk.py +2 -2
  521. mindspore/train/mind_ir_pb2.py +75 -6
  522. mindspore/train/model.py +41 -27
  523. mindspore/train/serialization.py +262 -133
  524. mindspore/train/summary/_writer_pool.py +1 -1
  525. mindspore/train/summary/summary_record.py +56 -34
  526. mindspore/train/train_thor/convert_utils.py +3 -3
  527. mindspore/version.py +1 -1
  528. {mindspore-2.2.11.dist-info → mindspore-2.3.0rc1.dist-info}/METADATA +2 -2
  529. {mindspore-2.2.11.dist-info → mindspore-2.3.0rc1.dist-info}/RECORD +532 -1075
  530. {mindspore-2.2.11.dist-info → mindspore-2.3.0rc1.dist-info}/entry_points.txt +1 -0
  531. mindspore/_extends/parallel_compile/tbe_compiler/tbe_adapter.py +0 -662
  532. mindspore/_extends/parallel_compile/tbe_compiler/tbe_helper.py +0 -377
  533. mindspore/_extends/parallel_compile/tbe_compiler/tbe_job.py +0 -201
  534. mindspore/_extends/parallel_compile/tbe_compiler/tbe_job_manager.py +0 -515
  535. mindspore/config/super_bar_config.json +0 -544
  536. mindspore/gen_ops.py +0 -273
  537. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_aicpu_kernels.so +0 -0
  538. mindspore/lib/plugin/ascend/libmindspore_aicpu_kernels.so +0 -0
  539. mindspore/lib/plugin/libmindspore_ascend.so.1 +0 -0
  540. mindspore/nn/layer/flash_attention.py +0 -189
  541. mindspore/ops/_op_impl/cpu/tensor_shape.py +0 -42
  542. mindspore/ops/_op_impl/tbe/__init__.py +0 -47
  543. mindspore/ops/_op_impl/tbe/abs.py +0 -38
  544. mindspore/ops/_op_impl/tbe/abs_ds.py +0 -39
  545. mindspore/ops/_op_impl/tbe/abs_grad.py +0 -43
  546. mindspore/ops/_op_impl/tbe/abs_grad_ds.py +0 -44
  547. mindspore/ops/_op_impl/tbe/accumulate_n_v2.py +0 -41
  548. mindspore/ops/_op_impl/tbe/accumulate_n_v2_ds.py +0 -42
  549. mindspore/ops/_op_impl/tbe/acos.py +0 -37
  550. mindspore/ops/_op_impl/tbe/acos_ds.py +0 -38
  551. mindspore/ops/_op_impl/tbe/acos_grad.py +0 -43
  552. mindspore/ops/_op_impl/tbe/acos_grad_ds.py +0 -44
  553. mindspore/ops/_op_impl/tbe/acosh.py +0 -37
  554. mindspore/ops/_op_impl/tbe/acosh_ds.py +0 -38
  555. mindspore/ops/_op_impl/tbe/acosh_grad.py +0 -43
  556. mindspore/ops/_op_impl/tbe/acosh_grad_ds.py +0 -44
  557. mindspore/ops/_op_impl/tbe/act_ulq_clamp_max_grad.py +0 -38
  558. mindspore/ops/_op_impl/tbe/act_ulq_clamp_min_grad.py +0 -38
  559. mindspore/ops/_op_impl/tbe/acts_ulq.py +0 -45
  560. mindspore/ops/_op_impl/tbe/acts_ulq_input_grad.py +0 -38
  561. mindspore/ops/_op_impl/tbe/adam_apply_one.py +0 -50
  562. mindspore/ops/_op_impl/tbe/adam_apply_one_assign.py +0 -53
  563. mindspore/ops/_op_impl/tbe/adam_apply_one_ds.py +0 -51
  564. mindspore/ops/_op_impl/tbe/adam_apply_one_with_decay.py +0 -54
  565. mindspore/ops/_op_impl/tbe/adam_apply_one_with_decay_assign.py +0 -54
  566. mindspore/ops/_op_impl/tbe/adam_apply_one_with_decay_ds.py +0 -55
  567. mindspore/ops/_op_impl/tbe/adaptive_max_pool2d.py +0 -37
  568. mindspore/ops/_op_impl/tbe/add.py +0 -42
  569. mindspore/ops/_op_impl/tbe/add_ds.py +0 -43
  570. mindspore/ops/_op_impl/tbe/add_n.py +0 -39
  571. mindspore/ops/_op_impl/tbe/add_n_ds.py +0 -40
  572. mindspore/ops/_op_impl/tbe/addcdiv.py +0 -41
  573. mindspore/ops/_op_impl/tbe/addcdiv_ds.py +0 -42
  574. mindspore/ops/_op_impl/tbe/addcmul.py +0 -43
  575. mindspore/ops/_op_impl/tbe/addcmul_ds.py +0 -44
  576. mindspore/ops/_op_impl/tbe/apply_ada_max.py +0 -68
  577. mindspore/ops/_op_impl/tbe/apply_ada_max_ds.py +0 -69
  578. mindspore/ops/_op_impl/tbe/apply_adadelta.py +0 -66
  579. mindspore/ops/_op_impl/tbe/apply_adadelta_ds.py +0 -67
  580. mindspore/ops/_op_impl/tbe/apply_adagrad.py +0 -55
  581. mindspore/ops/_op_impl/tbe/apply_adagrad_d_a.py +0 -67
  582. mindspore/ops/_op_impl/tbe/apply_adagrad_ds.py +0 -56
  583. mindspore/ops/_op_impl/tbe/apply_adagrad_v2.py +0 -48
  584. mindspore/ops/_op_impl/tbe/apply_adagrad_v2_ds.py +0 -49
  585. mindspore/ops/_op_impl/tbe/apply_adam.py +0 -79
  586. mindspore/ops/_op_impl/tbe/apply_adam_ds.py +0 -80
  587. mindspore/ops/_op_impl/tbe/apply_adam_with_amsgrad.py +0 -60
  588. mindspore/ops/_op_impl/tbe/apply_adam_with_amsgrad_ds.py +0 -61
  589. mindspore/ops/_op_impl/tbe/apply_add_sign.py +0 -65
  590. mindspore/ops/_op_impl/tbe/apply_add_sign_ds.py +0 -66
  591. mindspore/ops/_op_impl/tbe/apply_centered_rms_prop.py +0 -77
  592. mindspore/ops/_op_impl/tbe/apply_centered_rms_prop_ds.py +0 -78
  593. mindspore/ops/_op_impl/tbe/apply_ftrl.py +0 -67
  594. mindspore/ops/_op_impl/tbe/apply_ftrl_ds.py +0 -68
  595. mindspore/ops/_op_impl/tbe/apply_gradient_descent.py +0 -44
  596. mindspore/ops/_op_impl/tbe/apply_gradient_descent_ds.py +0 -45
  597. mindspore/ops/_op_impl/tbe/apply_keras_momentum.py +0 -49
  598. mindspore/ops/_op_impl/tbe/apply_momentum.py +0 -64
  599. mindspore/ops/_op_impl/tbe/apply_momentum_ds.py +0 -65
  600. mindspore/ops/_op_impl/tbe/apply_power_sign.py +0 -65
  601. mindspore/ops/_op_impl/tbe/apply_power_sign_ds.py +0 -66
  602. mindspore/ops/_op_impl/tbe/apply_proximal_adagrad.py +0 -57
  603. mindspore/ops/_op_impl/tbe/apply_proximal_adagrad_ds.py +0 -58
  604. mindspore/ops/_op_impl/tbe/apply_proximal_gradient_descent.py +0 -54
  605. mindspore/ops/_op_impl/tbe/apply_proximal_gradient_descent_ds.py +0 -55
  606. mindspore/ops/_op_impl/tbe/apply_rms_prop.py +0 -52
  607. mindspore/ops/_op_impl/tbe/approximate_equal.py +0 -39
  608. mindspore/ops/_op_impl/tbe/approximate_equal_ds.py +0 -40
  609. mindspore/ops/_op_impl/tbe/arg_max.py +0 -38
  610. mindspore/ops/_op_impl/tbe/arg_max_with_value.py +0 -38
  611. mindspore/ops/_op_impl/tbe/arg_max_with_value_ds.py +0 -39
  612. mindspore/ops/_op_impl/tbe/arg_min.py +0 -38
  613. mindspore/ops/_op_impl/tbe/arg_min_v2_ds.py +0 -40
  614. mindspore/ops/_op_impl/tbe/arg_min_with_value.py +0 -38
  615. mindspore/ops/_op_impl/tbe/arg_min_with_value_ds.py +0 -39
  616. mindspore/ops/_op_impl/tbe/asin.py +0 -37
  617. mindspore/ops/_op_impl/tbe/asin_ds.py +0 -38
  618. mindspore/ops/_op_impl/tbe/asin_grad.py +0 -43
  619. mindspore/ops/_op_impl/tbe/asin_grad_ds.py +0 -44
  620. mindspore/ops/_op_impl/tbe/asinh.py +0 -37
  621. mindspore/ops/_op_impl/tbe/asinh_ds.py +0 -38
  622. mindspore/ops/_op_impl/tbe/asinh_grad.py +0 -43
  623. mindspore/ops/_op_impl/tbe/asinh_grad_ds.py +0 -44
  624. mindspore/ops/_op_impl/tbe/assign.py +0 -79
  625. mindspore/ops/_op_impl/tbe/assign_add.py +0 -59
  626. mindspore/ops/_op_impl/tbe/assign_add_ds.py +0 -60
  627. mindspore/ops/_op_impl/tbe/assign_ds.py +0 -80
  628. mindspore/ops/_op_impl/tbe/assign_sub.py +0 -55
  629. mindspore/ops/_op_impl/tbe/assign_sub_ds.py +0 -56
  630. mindspore/ops/_op_impl/tbe/atan.py +0 -37
  631. mindspore/ops/_op_impl/tbe/atan2.py +0 -38
  632. mindspore/ops/_op_impl/tbe/atan2_ds.py +0 -39
  633. mindspore/ops/_op_impl/tbe/atan_ds.py +0 -38
  634. mindspore/ops/_op_impl/tbe/atan_grad.py +0 -43
  635. mindspore/ops/_op_impl/tbe/atan_grad_ds.py +0 -44
  636. mindspore/ops/_op_impl/tbe/atanh.py +0 -37
  637. mindspore/ops/_op_impl/tbe/atanh_ds.py +0 -38
  638. mindspore/ops/_op_impl/tbe/avg_pool.py +0 -43
  639. mindspore/ops/_op_impl/tbe/avg_pool_3d.py +0 -44
  640. mindspore/ops/_op_impl/tbe/avg_pool_3d_grad.py +0 -45
  641. mindspore/ops/_op_impl/tbe/avg_pool_ds.py +0 -44
  642. mindspore/ops/_op_impl/tbe/avg_pool_grad.py +0 -42
  643. mindspore/ops/_op_impl/tbe/avg_pool_grad_vm.py +0 -42
  644. mindspore/ops/_op_impl/tbe/basic_lstm_cell.py +0 -57
  645. mindspore/ops/_op_impl/tbe/basic_lstm_cell_c_state_grad.py +0 -50
  646. mindspore/ops/_op_impl/tbe/basic_lstm_cell_c_state_grad_v2.py +0 -51
  647. mindspore/ops/_op_impl/tbe/basic_lstm_cell_input_grad.py +0 -42
  648. mindspore/ops/_op_impl/tbe/basic_lstm_cell_weight_grad.py +0 -41
  649. mindspore/ops/_op_impl/tbe/batch_matmul.py +0 -42
  650. mindspore/ops/_op_impl/tbe/batch_matmul_ds.py +0 -41
  651. mindspore/ops/_op_impl/tbe/batch_matmul_v2.py +0 -47
  652. mindspore/ops/_op_impl/tbe/batch_to_space.py +0 -38
  653. mindspore/ops/_op_impl/tbe/batch_to_space_nd.py +0 -38
  654. mindspore/ops/_op_impl/tbe/batch_to_space_nd_ds.py +0 -39
  655. mindspore/ops/_op_impl/tbe/batch_to_space_nd_v2.py +0 -41
  656. mindspore/ops/_op_impl/tbe/batchnorm.py +0 -58
  657. mindspore/ops/_op_impl/tbe/batchnorm_grad.py +0 -58
  658. mindspore/ops/_op_impl/tbe/bce_with_logits_loss.py +0 -42
  659. mindspore/ops/_op_impl/tbe/bessel_i0e.py +0 -37
  660. mindspore/ops/_op_impl/tbe/bessel_i0e_ds.py +0 -38
  661. mindspore/ops/_op_impl/tbe/bessel_i1e.py +0 -37
  662. mindspore/ops/_op_impl/tbe/bessel_i1e_ds.py +0 -38
  663. mindspore/ops/_op_impl/tbe/bias_add.py +0 -38
  664. mindspore/ops/_op_impl/tbe/bias_add_ds.py +0 -39
  665. mindspore/ops/_op_impl/tbe/bias_add_grad.py +0 -53
  666. mindspore/ops/_op_impl/tbe/binary_cross_entropy.py +0 -39
  667. mindspore/ops/_op_impl/tbe/binary_cross_entropy_ds.py +0 -40
  668. mindspore/ops/_op_impl/tbe/binary_cross_entropy_grad.py +0 -44
  669. mindspore/ops/_op_impl/tbe/binary_cross_entropy_grad_ds.py +0 -45
  670. mindspore/ops/_op_impl/tbe/bitwise_and.py +0 -39
  671. mindspore/ops/_op_impl/tbe/bitwise_and_ds.py +0 -40
  672. mindspore/ops/_op_impl/tbe/bitwise_or.py +0 -39
  673. mindspore/ops/_op_impl/tbe/bitwise_or_ds.py +0 -40
  674. mindspore/ops/_op_impl/tbe/bitwise_xor.py +0 -39
  675. mindspore/ops/_op_impl/tbe/bitwise_xor_ds.py +0 -40
  676. mindspore/ops/_op_impl/tbe/bn_infer.py +0 -43
  677. mindspore/ops/_op_impl/tbe/bn_infer_ds.py +0 -45
  678. mindspore/ops/_op_impl/tbe/bn_infer_grad.py +0 -41
  679. mindspore/ops/_op_impl/tbe/bn_infer_grad_ds.py +0 -40
  680. mindspore/ops/_op_impl/tbe/bn_inference.py +0 -50
  681. mindspore/ops/_op_impl/tbe/bn_training_reduce.py +0 -38
  682. mindspore/ops/_op_impl/tbe/bn_training_reduce_ds.py +0 -39
  683. mindspore/ops/_op_impl/tbe/bn_training_reduce_grad.py +0 -46
  684. mindspore/ops/_op_impl/tbe/bn_training_reduce_grad_ds.py +0 -47
  685. mindspore/ops/_op_impl/tbe/bn_training_update.py +0 -52
  686. mindspore/ops/_op_impl/tbe/bn_training_update_ds.py +0 -53
  687. mindspore/ops/_op_impl/tbe/bn_training_update_grad.py +0 -44
  688. mindspore/ops/_op_impl/tbe/bn_training_update_grad_ds.py +0 -45
  689. mindspore/ops/_op_impl/tbe/bn_training_update_v2.py +0 -48
  690. mindspore/ops/_op_impl/tbe/bn_training_update_v3.py +0 -51
  691. mindspore/ops/_op_impl/tbe/bounding_box_decode.py +0 -41
  692. mindspore/ops/_op_impl/tbe/bounding_box_decode_ds.py +0 -42
  693. mindspore/ops/_op_impl/tbe/bounding_box_encode.py +0 -38
  694. mindspore/ops/_op_impl/tbe/broadcast_to.py +0 -40
  695. mindspore/ops/_op_impl/tbe/broadcast_to_ds.py +0 -44
  696. mindspore/ops/_op_impl/tbe/cast.py +0 -55
  697. mindspore/ops/_op_impl/tbe/cast_ds.py +0 -58
  698. mindspore/ops/_op_impl/tbe/cdist.py +0 -38
  699. mindspore/ops/_op_impl/tbe/cdist_grad.py +0 -42
  700. mindspore/ops/_op_impl/tbe/ceil.py +0 -37
  701. mindspore/ops/_op_impl/tbe/ceil_ds.py +0 -38
  702. mindspore/ops/_op_impl/tbe/celu.py +0 -39
  703. mindspore/ops/_op_impl/tbe/centralization.py +0 -39
  704. mindspore/ops/_op_impl/tbe/check_valid.py +0 -38
  705. mindspore/ops/_op_impl/tbe/check_valid_ds.py +0 -39
  706. mindspore/ops/_op_impl/tbe/clip_by_norm_no_div_sum.py +0 -41
  707. mindspore/ops/_op_impl/tbe/clip_by_norm_no_div_sum_ds.py +0 -42
  708. mindspore/ops/_op_impl/tbe/clip_by_value.py +0 -41
  709. mindspore/ops/_op_impl/tbe/clip_by_value_ds.py +0 -42
  710. mindspore/ops/_op_impl/tbe/concat.py +0 -40
  711. mindspore/ops/_op_impl/tbe/concat_ds.py +0 -38
  712. mindspore/ops/_op_impl/tbe/confusion_matrix.py +0 -63
  713. mindspore/ops/_op_impl/tbe/confusion_mul_grad.py +0 -40
  714. mindspore/ops/_op_impl/tbe/confusion_softmax_grad.py +0 -41
  715. mindspore/ops/_op_impl/tbe/confusion_transpose_d.py +0 -39
  716. mindspore/ops/_op_impl/tbe/conv2d.py +0 -47
  717. mindspore/ops/_op_impl/tbe/conv2d_backprop_filter.py +0 -42
  718. mindspore/ops/_op_impl/tbe/conv2d_backprop_filter_ds.py +0 -43
  719. mindspore/ops/_op_impl/tbe/conv2d_backprop_input.py +0 -42
  720. mindspore/ops/_op_impl/tbe/conv2d_backprop_input_ds.py +0 -44
  721. mindspore/ops/_op_impl/tbe/conv2d_ds.py +0 -47
  722. mindspore/ops/_op_impl/tbe/conv2d_transpose.py +0 -48
  723. mindspore/ops/_op_impl/tbe/conv3d.py +0 -45
  724. mindspore/ops/_op_impl/tbe/conv3d_backprop_filter.py +0 -42
  725. mindspore/ops/_op_impl/tbe/conv3d_backprop_input.py +0 -42
  726. mindspore/ops/_op_impl/tbe/conv3d_transpose.py +0 -47
  727. mindspore/ops/_op_impl/tbe/conv3d_transpose_ds.py +0 -48
  728. mindspore/ops/_op_impl/tbe/cos.py +0 -37
  729. mindspore/ops/_op_impl/tbe/cos_ds.py +0 -38
  730. mindspore/ops/_op_impl/tbe/cosh.py +0 -37
  731. mindspore/ops/_op_impl/tbe/cosh_ds.py +0 -38
  732. mindspore/ops/_op_impl/tbe/ctc_loss_v2.py +0 -42
  733. mindspore/ops/_op_impl/tbe/ctc_loss_v2_grad.py +0 -44
  734. mindspore/ops/_op_impl/tbe/cum_sum.py +0 -42
  735. mindspore/ops/_op_impl/tbe/cum_sum_ds.py +0 -44
  736. mindspore/ops/_op_impl/tbe/cummin.py +0 -41
  737. mindspore/ops/_op_impl/tbe/cumprod.py +0 -42
  738. mindspore/ops/_op_impl/tbe/data_format_dim_map.py +0 -38
  739. mindspore/ops/_op_impl/tbe/data_format_dim_map_ds.py +0 -40
  740. mindspore/ops/_op_impl/tbe/deformable_offsets.py +0 -45
  741. mindspore/ops/_op_impl/tbe/deformable_offsets_grad.py +0 -48
  742. mindspore/ops/_op_impl/tbe/depth_to_space_ds.py +0 -49
  743. mindspore/ops/_op_impl/tbe/depthwise_conv2d.py +0 -44
  744. mindspore/ops/_op_impl/tbe/depthwise_conv2d_backprop_filter.py +0 -41
  745. mindspore/ops/_op_impl/tbe/depthwise_conv2d_backprop_input.py +0 -41
  746. mindspore/ops/_op_impl/tbe/diag.py +0 -38
  747. mindspore/ops/_op_impl/tbe/diag_part.py +0 -38
  748. mindspore/ops/_op_impl/tbe/dilation.py +0 -40
  749. mindspore/ops/_op_impl/tbe/div.py +0 -41
  750. mindspore/ops/_op_impl/tbe/div_ds.py +0 -42
  751. mindspore/ops/_op_impl/tbe/div_no_nan.py +0 -41
  752. mindspore/ops/_op_impl/tbe/div_no_nan_ds.py +0 -42
  753. mindspore/ops/_op_impl/tbe/dropout_do_mask.py +0 -38
  754. mindspore/ops/_op_impl/tbe/dropout_do_mask_ds.py +0 -39
  755. mindspore/ops/_op_impl/tbe/dropout_do_mask_v3.py +0 -39
  756. mindspore/ops/_op_impl/tbe/dynamic_atomic_addr_clean.py +0 -34
  757. mindspore/ops/_op_impl/tbe/dynamic_gru_v2.py +0 -95
  758. mindspore/ops/_op_impl/tbe/dynamic_rnn.py +0 -82
  759. mindspore/ops/_op_impl/tbe/elu.py +0 -38
  760. mindspore/ops/_op_impl/tbe/elu_ds.py +0 -39
  761. mindspore/ops/_op_impl/tbe/elu_grad.py +0 -43
  762. mindspore/ops/_op_impl/tbe/elu_grad_ds.py +0 -44
  763. mindspore/ops/_op_impl/tbe/equal.py +0 -42
  764. mindspore/ops/_op_impl/tbe/equal_ds.py +0 -42
  765. mindspore/ops/_op_impl/tbe/erf.py +0 -37
  766. mindspore/ops/_op_impl/tbe/erf_ds.py +0 -38
  767. mindspore/ops/_op_impl/tbe/erfc.py +0 -37
  768. mindspore/ops/_op_impl/tbe/erfc_ds.py +0 -38
  769. mindspore/ops/_op_impl/tbe/erfinv.py +0 -36
  770. mindspore/ops/_op_impl/tbe/exp.py +0 -40
  771. mindspore/ops/_op_impl/tbe/exp_ds.py +0 -41
  772. mindspore/ops/_op_impl/tbe/expand_dims.py +0 -38
  773. mindspore/ops/_op_impl/tbe/expm1.py +0 -37
  774. mindspore/ops/_op_impl/tbe/expm1_ds.py +0 -38
  775. mindspore/ops/_op_impl/tbe/extract_image_patches.py +0 -41
  776. mindspore/ops/_op_impl/tbe/extract_volume_patches.py +0 -39
  777. mindspore/ops/_op_impl/tbe/fake_quant_with_min_max_vars.py +0 -39
  778. mindspore/ops/_op_impl/tbe/fake_quant_with_min_max_vars_gradient.py +0 -43
  779. mindspore/ops/_op_impl/tbe/fake_quant_with_min_max_vars_per_channel.py +0 -39
  780. mindspore/ops/_op_impl/tbe/fake_quant_with_min_max_vars_per_channel_gradient.py +0 -43
  781. mindspore/ops/_op_impl/tbe/fast_gelu.py +0 -37
  782. mindspore/ops/_op_impl/tbe/fast_gelu_ds.py +0 -38
  783. mindspore/ops/_op_impl/tbe/fast_gelu_grad.py +0 -41
  784. mindspore/ops/_op_impl/tbe/fast_gelu_grad_ds.py +0 -42
  785. mindspore/ops/_op_impl/tbe/fill.py +0 -56
  786. mindspore/ops/_op_impl/tbe/fill_ds.py +0 -42
  787. mindspore/ops/_op_impl/tbe/flatten.py +0 -48
  788. mindspore/ops/_op_impl/tbe/floor.py +0 -37
  789. mindspore/ops/_op_impl/tbe/floor_div.py +0 -41
  790. mindspore/ops/_op_impl/tbe/floor_div_ds.py +0 -42
  791. mindspore/ops/_op_impl/tbe/floor_ds.py +0 -38
  792. mindspore/ops/_op_impl/tbe/floor_mod.py +0 -39
  793. mindspore/ops/_op_impl/tbe/floor_mod_ds.py +0 -40
  794. mindspore/ops/_op_impl/tbe/fused_dbn_dw.py +0 -52
  795. mindspore/ops/_op_impl/tbe/fused_mul_add.py +0 -38
  796. mindspore/ops/_op_impl/tbe/fused_mul_add_n.py +0 -48
  797. mindspore/ops/_op_impl/tbe/fused_mul_add_n_l2loss.py +0 -53
  798. mindspore/ops/_op_impl/tbe/fused_mul_apply_momentum.py +0 -57
  799. mindspore/ops/_op_impl/tbe/fused_mul_apply_momentum_extern.py +0 -67
  800. mindspore/ops/_op_impl/tbe/gather_nd.py +0 -52
  801. mindspore/ops/_op_impl/tbe/gather_nd_ds.py +0 -48
  802. mindspore/ops/_op_impl/tbe/gather_v2.py +0 -56
  803. mindspore/ops/_op_impl/tbe/gather_v2_ds.py +0 -68
  804. mindspore/ops/_op_impl/tbe/gelu.py +0 -37
  805. mindspore/ops/_op_impl/tbe/gelu_ds.py +0 -38
  806. mindspore/ops/_op_impl/tbe/gelu_grad.py +0 -42
  807. mindspore/ops/_op_impl/tbe/gelu_grad_ds.py +0 -43
  808. mindspore/ops/_op_impl/tbe/ger.py +0 -43
  809. mindspore/ops/_op_impl/tbe/ger_ds.py +0 -44
  810. mindspore/ops/_op_impl/tbe/greater.py +0 -43
  811. mindspore/ops/_op_impl/tbe/greater_equal.py +0 -41
  812. mindspore/ops/_op_impl/tbe/greater_equal_ds.py +0 -42
  813. mindspore/ops/_op_impl/tbe/gru_v2_hidden_grad.py +0 -51
  814. mindspore/ops/_op_impl/tbe/gru_v2_hidden_grad_cell.py +0 -52
  815. mindspore/ops/_op_impl/tbe/hard_swish.py +0 -37
  816. mindspore/ops/_op_impl/tbe/hard_swish_ds.py +0 -38
  817. mindspore/ops/_op_impl/tbe/hard_swish_grad.py +0 -41
  818. mindspore/ops/_op_impl/tbe/hard_swish_grad_ds.py +0 -42
  819. mindspore/ops/_op_impl/tbe/histogram_fixed_width.py +0 -40
  820. mindspore/ops/_op_impl/tbe/hshrink.py +0 -33
  821. mindspore/ops/_op_impl/tbe/hshrink_grad.py +0 -37
  822. mindspore/ops/_op_impl/tbe/hsigmoid.py +0 -45
  823. mindspore/ops/_op_impl/tbe/hsigmoid_grad.py +0 -39
  824. mindspore/ops/_op_impl/tbe/ifmr.py +0 -47
  825. mindspore/ops/_op_impl/tbe/ifmr_ds.py +0 -48
  826. mindspore/ops/_op_impl/tbe/im2col.py +0 -42
  827. mindspore/ops/_op_impl/tbe/in_top_k.py +0 -37
  828. mindspore/ops/_op_impl/tbe/inplace_add.py +0 -39
  829. mindspore/ops/_op_impl/tbe/inplace_index_add.py +0 -46
  830. mindspore/ops/_op_impl/tbe/inplace_sub.py +0 -39
  831. mindspore/ops/_op_impl/tbe/inplace_update.py +0 -39
  832. mindspore/ops/_op_impl/tbe/inplace_update_ds.py +0 -40
  833. mindspore/ops/_op_impl/tbe/inv.py +0 -38
  834. mindspore/ops/_op_impl/tbe/inv_ds.py +0 -39
  835. mindspore/ops/_op_impl/tbe/inv_grad.py +0 -40
  836. mindspore/ops/_op_impl/tbe/inv_grad_ds.py +0 -41
  837. mindspore/ops/_op_impl/tbe/invert.py +0 -37
  838. mindspore/ops/_op_impl/tbe/invert_ds.py +0 -38
  839. mindspore/ops/_op_impl/tbe/iou.py +0 -38
  840. mindspore/ops/_op_impl/tbe/iou_ds.py +0 -39
  841. mindspore/ops/_op_impl/tbe/is_close.py +0 -40
  842. mindspore/ops/_op_impl/tbe/kl_div_loss.py +0 -38
  843. mindspore/ops/_op_impl/tbe/kl_div_loss_ds.py +0 -39
  844. mindspore/ops/_op_impl/tbe/kl_div_loss_grad.py +0 -40
  845. mindspore/ops/_op_impl/tbe/l2_loss.py +0 -36
  846. mindspore/ops/_op_impl/tbe/l2_loss_ds.py +0 -37
  847. mindspore/ops/_op_impl/tbe/l2_normalize.py +0 -38
  848. mindspore/ops/_op_impl/tbe/l2_normalize_grad.py +0 -40
  849. mindspore/ops/_op_impl/tbe/lamb_apply_optimizer_assign.py +0 -55
  850. mindspore/ops/_op_impl/tbe/lamb_apply_weight_assign.py +0 -42
  851. mindspore/ops/_op_impl/tbe/lamb_next_mv.py +0 -59
  852. mindspore/ops/_op_impl/tbe/lamb_next_mv_with_decay.py +0 -59
  853. mindspore/ops/_op_impl/tbe/lamb_next_right.py +0 -44
  854. mindspore/ops/_op_impl/tbe/lamb_update_with_lr.py +0 -48
  855. mindspore/ops/_op_impl/tbe/lamb_update_with_lr_v2.py +0 -44
  856. mindspore/ops/_op_impl/tbe/lars_update.py +0 -50
  857. mindspore/ops/_op_impl/tbe/lars_update_ds.py +0 -51
  858. mindspore/ops/_op_impl/tbe/layer_norm.py +0 -46
  859. mindspore/ops/_op_impl/tbe/layer_norm_beta_gamma_backprop.py +0 -44
  860. mindspore/ops/_op_impl/tbe/layer_norm_beta_gamma_backprop_ds.py +0 -45
  861. mindspore/ops/_op_impl/tbe/layer_norm_beta_gamma_backprop_v2.py +0 -40
  862. mindspore/ops/_op_impl/tbe/layer_norm_beta_gamma_backprop_v2_ds.py +0 -41
  863. mindspore/ops/_op_impl/tbe/layer_norm_ds.py +0 -47
  864. mindspore/ops/_op_impl/tbe/layer_norm_grad.py +0 -48
  865. mindspore/ops/_op_impl/tbe/layer_norm_x_backprop.py +0 -43
  866. mindspore/ops/_op_impl/tbe/layer_norm_x_backprop_ds.py +0 -44
  867. mindspore/ops/_op_impl/tbe/layer_norm_x_backprop_v2.py +0 -45
  868. mindspore/ops/_op_impl/tbe/layer_norm_x_backprop_v2_ds.py +0 -45
  869. mindspore/ops/_op_impl/tbe/lerp.py +0 -38
  870. mindspore/ops/_op_impl/tbe/less.py +0 -41
  871. mindspore/ops/_op_impl/tbe/less_ds.py +0 -42
  872. mindspore/ops/_op_impl/tbe/less_equal.py +0 -41
  873. mindspore/ops/_op_impl/tbe/less_equal_ds.py +0 -42
  874. mindspore/ops/_op_impl/tbe/log.py +0 -40
  875. mindspore/ops/_op_impl/tbe/log1p.py +0 -37
  876. mindspore/ops/_op_impl/tbe/log1p_ds.py +0 -38
  877. mindspore/ops/_op_impl/tbe/log_ds.py +0 -41
  878. mindspore/ops/_op_impl/tbe/logical_and.py +0 -37
  879. mindspore/ops/_op_impl/tbe/logical_and_ds.py +0 -38
  880. mindspore/ops/_op_impl/tbe/logical_not.py +0 -36
  881. mindspore/ops/_op_impl/tbe/logical_not_ds.py +0 -37
  882. mindspore/ops/_op_impl/tbe/logical_or.py +0 -37
  883. mindspore/ops/_op_impl/tbe/logical_or_ds.py +0 -38
  884. mindspore/ops/_op_impl/tbe/logsoftmax.py +0 -37
  885. mindspore/ops/_op_impl/tbe/logsoftmax_ds.py +0 -38
  886. mindspore/ops/_op_impl/tbe/logsoftmax_grad.py +0 -38
  887. mindspore/ops/_op_impl/tbe/logsoftmax_grad_ds.py +0 -39
  888. mindspore/ops/_op_impl/tbe/lp_norm.py +0 -40
  889. mindspore/ops/_op_impl/tbe/lp_norm_ds.py +0 -41
  890. mindspore/ops/_op_impl/tbe/lrn.py +0 -41
  891. mindspore/ops/_op_impl/tbe/lrn_grad.py +0 -42
  892. mindspore/ops/_op_impl/tbe/lstm_input_grad.py +0 -51
  893. mindspore/ops/_op_impl/tbe/masked_fill.py +0 -40
  894. mindspore/ops/_op_impl/tbe/masked_fill_ds.py +0 -41
  895. mindspore/ops/_op_impl/tbe/matmul.py +0 -53
  896. mindspore/ops/_op_impl/tbe/matmul_ds.py +0 -47
  897. mindspore/ops/_op_impl/tbe/matmul_v2.py +0 -50
  898. mindspore/ops/_op_impl/tbe/matrix_diag.py +0 -45
  899. mindspore/ops/_op_impl/tbe/matrix_diag_part.py +0 -45
  900. mindspore/ops/_op_impl/tbe/matrix_set_diag.py +0 -46
  901. mindspore/ops/_op_impl/tbe/max_pool.py +0 -39
  902. mindspore/ops/_op_impl/tbe/max_pool3d.py +0 -44
  903. mindspore/ops/_op_impl/tbe/max_pool3d_grad.py +0 -43
  904. mindspore/ops/_op_impl/tbe/max_pool3d_grad_grad.py +0 -44
  905. mindspore/ops/_op_impl/tbe/max_pool_ds.py +0 -40
  906. mindspore/ops/_op_impl/tbe/max_pool_grad.py +0 -43
  907. mindspore/ops/_op_impl/tbe/max_pool_grad_grad.py +0 -41
  908. mindspore/ops/_op_impl/tbe/max_pool_grad_grad_with_argmax.py +0 -41
  909. mindspore/ops/_op_impl/tbe/max_pool_grad_with_argmax.py +0 -42
  910. mindspore/ops/_op_impl/tbe/max_pool_with_argmax.py +0 -40
  911. mindspore/ops/_op_impl/tbe/maximum.py +0 -39
  912. mindspore/ops/_op_impl/tbe/maximum_ds.py +0 -40
  913. mindspore/ops/_op_impl/tbe/maximum_grad.py +0 -46
  914. mindspore/ops/_op_impl/tbe/maximum_grad_ds.py +0 -47
  915. mindspore/ops/_op_impl/tbe/mem_set.py +0 -38
  916. mindspore/ops/_op_impl/tbe/minimum.py +0 -40
  917. mindspore/ops/_op_impl/tbe/minimum_ds.py +0 -41
  918. mindspore/ops/_op_impl/tbe/minimum_grad.py +0 -46
  919. mindspore/ops/_op_impl/tbe/minimum_grad_ds.py +0 -47
  920. mindspore/ops/_op_impl/tbe/mish.py +0 -37
  921. mindspore/ops/_op_impl/tbe/mod.py +0 -41
  922. mindspore/ops/_op_impl/tbe/mod_ds.py +0 -42
  923. mindspore/ops/_op_impl/tbe/mul.py +0 -37
  924. mindspore/ops/_op_impl/tbe/mul_ds.py +0 -38
  925. mindspore/ops/_op_impl/tbe/mul_no_nan.py +0 -39
  926. mindspore/ops/_op_impl/tbe/mul_no_nan_ds.py +0 -40
  927. mindspore/ops/_op_impl/tbe/multilabel_margin_loss.py +0 -39
  928. mindspore/ops/_op_impl/tbe/neg.py +0 -39
  929. mindspore/ops/_op_impl/tbe/neg_ds.py +0 -40
  930. mindspore/ops/_op_impl/tbe/new_im2col.py +0 -40
  931. mindspore/ops/_op_impl/tbe/nll_loss.py +0 -41
  932. mindspore/ops/_op_impl/tbe/nll_loss_grad.py +0 -44
  933. mindspore/ops/_op_impl/tbe/nms_with_mask.py +0 -39
  934. mindspore/ops/_op_impl/tbe/not_equal.py +0 -41
  935. mindspore/ops/_op_impl/tbe/not_equal_ds.py +0 -42
  936. mindspore/ops/_op_impl/tbe/npu_alloc_float_status.py +0 -34
  937. mindspore/ops/_op_impl/tbe/npu_clear_float_status.py +0 -35
  938. mindspore/ops/_op_impl/tbe/npu_clear_float_status_v2.py +0 -35
  939. mindspore/ops/_op_impl/tbe/npu_get_float_status.py +0 -35
  940. mindspore/ops/_op_impl/tbe/npu_get_float_status_v2.py +0 -35
  941. mindspore/ops/_op_impl/tbe/one_hot.py +0 -48
  942. mindspore/ops/_op_impl/tbe/one_hot_ds.py +0 -45
  943. mindspore/ops/_op_impl/tbe/ones_like.py +0 -40
  944. mindspore/ops/_op_impl/tbe/ones_like_ds.py +0 -41
  945. mindspore/ops/_op_impl/tbe/p_s_r_o_i_pooling.py +0 -40
  946. mindspore/ops/_op_impl/tbe/p_s_r_o_i_pooling_grad.py +0 -40
  947. mindspore/ops/_op_impl/tbe/pack.py +0 -58
  948. mindspore/ops/_op_impl/tbe/pack_ds.py +0 -59
  949. mindspore/ops/_op_impl/tbe/pad_d.py +0 -40
  950. mindspore/ops/_op_impl/tbe/pad_d_ds.py +0 -41
  951. mindspore/ops/_op_impl/tbe/parallel_concat.py +0 -70
  952. mindspore/ops/_op_impl/tbe/parallel_resize_bilinear.py +0 -45
  953. mindspore/ops/_op_impl/tbe/parallel_resize_bilinear_grad.py +0 -44
  954. mindspore/ops/_op_impl/tbe/pdist.py +0 -36
  955. mindspore/ops/_op_impl/tbe/pooling.py +0 -46
  956. mindspore/ops/_op_impl/tbe/population_count.py +0 -38
  957. mindspore/ops/_op_impl/tbe/pow.py +0 -41
  958. mindspore/ops/_op_impl/tbe/pow_ds.py +0 -42
  959. mindspore/ops/_op_impl/tbe/prelu.py +0 -37
  960. mindspore/ops/_op_impl/tbe/prelu_ds.py +0 -38
  961. mindspore/ops/_op_impl/tbe/prelu_grad.py +0 -40
  962. mindspore/ops/_op_impl/tbe/range.py +0 -39
  963. mindspore/ops/_op_impl/tbe/real_div.py +0 -38
  964. mindspore/ops/_op_impl/tbe/real_div_ds.py +0 -39
  965. mindspore/ops/_op_impl/tbe/reciprocal.py +0 -36
  966. mindspore/ops/_op_impl/tbe/reciprocal_ds.py +0 -37
  967. mindspore/ops/_op_impl/tbe/reciprocal_grad.py +0 -38
  968. mindspore/ops/_op_impl/tbe/reciprocal_grad_ds.py +0 -39
  969. mindspore/ops/_op_impl/tbe/reduce_all.py +0 -38
  970. mindspore/ops/_op_impl/tbe/reduce_all_ds.py +0 -39
  971. mindspore/ops/_op_impl/tbe/reduce_any.py +0 -38
  972. mindspore/ops/_op_impl/tbe/reduce_any_ds.py +0 -39
  973. mindspore/ops/_op_impl/tbe/reduce_max.py +0 -43
  974. mindspore/ops/_op_impl/tbe/reduce_max_ds.py +0 -41
  975. mindspore/ops/_op_impl/tbe/reduce_mean.py +0 -40
  976. mindspore/ops/_op_impl/tbe/reduce_mean_ds.py +0 -42
  977. mindspore/ops/_op_impl/tbe/reduce_min.py +0 -41
  978. mindspore/ops/_op_impl/tbe/reduce_min_ds.py +0 -41
  979. mindspore/ops/_op_impl/tbe/reduce_prod.py +0 -42
  980. mindspore/ops/_op_impl/tbe/reduce_prod_ds.py +0 -41
  981. mindspore/ops/_op_impl/tbe/reduce_std.py +0 -44
  982. mindspore/ops/_op_impl/tbe/reduce_sum.py +0 -39
  983. mindspore/ops/_op_impl/tbe/reduce_sum_ds.py +0 -41
  984. mindspore/ops/_op_impl/tbe/relu.py +0 -39
  985. mindspore/ops/_op_impl/tbe/relu6.py +0 -38
  986. mindspore/ops/_op_impl/tbe/relu6_ds.py +0 -39
  987. mindspore/ops/_op_impl/tbe/relu6_grad.py +0 -43
  988. mindspore/ops/_op_impl/tbe/relu6_grad_ds.py +0 -44
  989. mindspore/ops/_op_impl/tbe/relu_ds.py +0 -40
  990. mindspore/ops/_op_impl/tbe/relu_grad.py +0 -41
  991. mindspore/ops/_op_impl/tbe/relu_grad_ds.py +0 -42
  992. mindspore/ops/_op_impl/tbe/relu_grad_v2.py +0 -40
  993. mindspore/ops/_op_impl/tbe/relu_grad_v2_ds.py +0 -41
  994. mindspore/ops/_op_impl/tbe/relu_v2.py +0 -40
  995. mindspore/ops/_op_impl/tbe/relu_v2_ds.py +0 -41
  996. mindspore/ops/_op_impl/tbe/renorm.py +0 -39
  997. mindspore/ops/_op_impl/tbe/resize_bilinear.py +0 -40
  998. mindspore/ops/_op_impl/tbe/resize_bilinear_grad.py +0 -41
  999. mindspore/ops/_op_impl/tbe/resize_bilinear_v2.py +0 -43
  1000. mindspore/ops/_op_impl/tbe/resize_nearest_neighbor.py +0 -40
  1001. mindspore/ops/_op_impl/tbe/resize_nearest_neighbor_ds.py +0 -40
  1002. mindspore/ops/_op_impl/tbe/resize_nearest_neighbor_grad.py +0 -39
  1003. mindspore/ops/_op_impl/tbe/resize_nearest_neighbor_grad_ds.py +0 -42
  1004. mindspore/ops/_op_impl/tbe/reverse_v2_d.py +0 -37
  1005. mindspore/ops/_op_impl/tbe/rint.py +0 -37
  1006. mindspore/ops/_op_impl/tbe/rint_ds.py +0 -38
  1007. mindspore/ops/_op_impl/tbe/roi_align.py +0 -43
  1008. mindspore/ops/_op_impl/tbe/roi_align_ds.py +0 -44
  1009. mindspore/ops/_op_impl/tbe/roi_align_grad.py +0 -43
  1010. mindspore/ops/_op_impl/tbe/roi_align_grad_ds.py +0 -44
  1011. mindspore/ops/_op_impl/tbe/roll.py +0 -42
  1012. mindspore/ops/_op_impl/tbe/round.py +0 -38
  1013. mindspore/ops/_op_impl/tbe/round_ds.py +0 -39
  1014. mindspore/ops/_op_impl/tbe/rsqrt.py +0 -37
  1015. mindspore/ops/_op_impl/tbe/rsqrt_ds.py +0 -38
  1016. mindspore/ops/_op_impl/tbe/rsqrt_grad.py +0 -40
  1017. mindspore/ops/_op_impl/tbe/rsqrt_grad_ds.py +0 -41
  1018. mindspore/ops/_op_impl/tbe/scatter_add.py +0 -44
  1019. mindspore/ops/_op_impl/tbe/scatter_div.py +0 -46
  1020. mindspore/ops/_op_impl/tbe/scatter_max.py +0 -45
  1021. mindspore/ops/_op_impl/tbe/scatter_min.py +0 -45
  1022. mindspore/ops/_op_impl/tbe/scatter_mul.py +0 -44
  1023. mindspore/ops/_op_impl/tbe/scatter_nd.py +0 -41
  1024. mindspore/ops/_op_impl/tbe/scatter_nd_add.py +0 -45
  1025. mindspore/ops/_op_impl/tbe/scatter_nd_d.py +0 -41
  1026. mindspore/ops/_op_impl/tbe/scatter_nd_ds.py +0 -49
  1027. mindspore/ops/_op_impl/tbe/scatter_nd_sub.py +0 -47
  1028. mindspore/ops/_op_impl/tbe/scatter_nd_sub_ds.py +0 -48
  1029. mindspore/ops/_op_impl/tbe/scatter_nd_update.py +0 -47
  1030. mindspore/ops/_op_impl/tbe/scatter_nd_update_ds.py +0 -48
  1031. mindspore/ops/_op_impl/tbe/scatter_non_aliasing_add.py +0 -39
  1032. mindspore/ops/_op_impl/tbe/scatter_non_aliasing_add_ds.py +0 -40
  1033. mindspore/ops/_op_impl/tbe/scatter_sub.py +0 -47
  1034. mindspore/ops/_op_impl/tbe/scatter_sub_ds.py +0 -48
  1035. mindspore/ops/_op_impl/tbe/scatter_update.py +0 -43
  1036. mindspore/ops/_op_impl/tbe/select.py +0 -38
  1037. mindspore/ops/_op_impl/tbe/select_ds.py +0 -39
  1038. mindspore/ops/_op_impl/tbe/selu.py +0 -39
  1039. mindspore/ops/_op_impl/tbe/selu_ds.py +0 -40
  1040. mindspore/ops/_op_impl/tbe/sgd.py +0 -62
  1041. mindspore/ops/_op_impl/tbe/sigmoid.py +0 -37
  1042. mindspore/ops/_op_impl/tbe/sigmoid_cross_entropy_with_logits.py +0 -41
  1043. mindspore/ops/_op_impl/tbe/sigmoid_cross_entropy_with_logits_ds.py +0 -42
  1044. mindspore/ops/_op_impl/tbe/sigmoid_cross_entropy_with_logits_grad.py +0 -42
  1045. mindspore/ops/_op_impl/tbe/sigmoid_cross_entropy_with_logits_grad_ds.py +0 -43
  1046. mindspore/ops/_op_impl/tbe/sigmoid_ds.py +0 -38
  1047. mindspore/ops/_op_impl/tbe/sigmoid_grad.py +0 -39
  1048. mindspore/ops/_op_impl/tbe/sigmoid_grad_ds.py +0 -40
  1049. mindspore/ops/_op_impl/tbe/sign.py +0 -38
  1050. mindspore/ops/_op_impl/tbe/sign_ds.py +0 -39
  1051. mindspore/ops/_op_impl/tbe/sin.py +0 -37
  1052. mindspore/ops/_op_impl/tbe/sin_ds.py +0 -38
  1053. mindspore/ops/_op_impl/tbe/sinh.py +0 -37
  1054. mindspore/ops/_op_impl/tbe/sinh_ds.py +0 -38
  1055. mindspore/ops/_op_impl/tbe/slice.py +0 -58
  1056. mindspore/ops/_op_impl/tbe/smooth_l1_loss.py +0 -45
  1057. mindspore/ops/_op_impl/tbe/smooth_l1_loss_ds.py +0 -46
  1058. mindspore/ops/_op_impl/tbe/smooth_l1_loss_grad.py +0 -46
  1059. mindspore/ops/_op_impl/tbe/smooth_l1_loss_grad_ds.py +0 -47
  1060. mindspore/ops/_op_impl/tbe/soft_margin_loss.py +0 -38
  1061. mindspore/ops/_op_impl/tbe/soft_margin_loss_grad.py +0 -39
  1062. mindspore/ops/_op_impl/tbe/soft_shrink.py +0 -36
  1063. mindspore/ops/_op_impl/tbe/soft_shrink_grad.py +0 -38
  1064. mindspore/ops/_op_impl/tbe/softmax.py +0 -37
  1065. mindspore/ops/_op_impl/tbe/softmax_cross_entropy_with_logits.py +0 -38
  1066. mindspore/ops/_op_impl/tbe/softmax_cross_entropy_with_logits_ds.py +0 -39
  1067. mindspore/ops/_op_impl/tbe/softmax_ds.py +0 -38
  1068. mindspore/ops/_op_impl/tbe/softmax_grad_ext.py +0 -42
  1069. mindspore/ops/_op_impl/tbe/softmax_v2_with_dropout_do_mask_v3.py +0 -39
  1070. mindspore/ops/_op_impl/tbe/softplus.py +0 -37
  1071. mindspore/ops/_op_impl/tbe/softplus_ds.py +0 -38
  1072. mindspore/ops/_op_impl/tbe/softplus_grad.py +0 -38
  1073. mindspore/ops/_op_impl/tbe/softplus_grad_ds.py +0 -38
  1074. mindspore/ops/_op_impl/tbe/softsign.py +0 -37
  1075. mindspore/ops/_op_impl/tbe/softsign_ds.py +0 -38
  1076. mindspore/ops/_op_impl/tbe/sort.py +0 -38
  1077. mindspore/ops/_op_impl/tbe/sort_ds.py +0 -39
  1078. mindspore/ops/_op_impl/tbe/space_to_batch.py +0 -38
  1079. mindspore/ops/_op_impl/tbe/space_to_batch_nd.py +0 -38
  1080. mindspore/ops/_op_impl/tbe/space_to_depth.py +0 -47
  1081. mindspore/ops/_op_impl/tbe/sparse_apply_adadelta.py +0 -56
  1082. mindspore/ops/_op_impl/tbe/sparse_apply_adagrad.py +0 -45
  1083. mindspore/ops/_op_impl/tbe/sparse_apply_adagrad_ds.py +0 -46
  1084. mindspore/ops/_op_impl/tbe/sparse_apply_adagrad_v2.py +0 -46
  1085. mindspore/ops/_op_impl/tbe/sparse_apply_adagrad_v2_ds.py +0 -47
  1086. mindspore/ops/_op_impl/tbe/sparse_apply_ftrl_d.py +0 -53
  1087. mindspore/ops/_op_impl/tbe/sparse_apply_ftrl_d_ds.py +0 -50
  1088. mindspore/ops/_op_impl/tbe/sparse_apply_ftrl_v2.py +0 -50
  1089. mindspore/ops/_op_impl/tbe/sparse_apply_proximal_adagrad.py +0 -66
  1090. mindspore/ops/_op_impl/tbe/sparse_apply_proximal_adagrad_ds.py +0 -67
  1091. mindspore/ops/_op_impl/tbe/sparse_apply_r_m_s_prop.py +0 -57
  1092. mindspore/ops/_op_impl/tbe/sparse_apply_r_m_s_prop_ds.py +0 -58
  1093. mindspore/ops/_op_impl/tbe/sparse_gather_v2.py +0 -56
  1094. mindspore/ops/_op_impl/tbe/sparse_gather_v2_ds.py +0 -58
  1095. mindspore/ops/_op_impl/tbe/split_d.py +0 -38
  1096. mindspore/ops/_op_impl/tbe/split_d_ds.py +0 -39
  1097. mindspore/ops/_op_impl/tbe/split_v.py +0 -39
  1098. mindspore/ops/_op_impl/tbe/splitv.py +0 -39
  1099. mindspore/ops/_op_impl/tbe/sqrt.py +0 -37
  1100. mindspore/ops/_op_impl/tbe/sqrt_ds.py +0 -38
  1101. mindspore/ops/_op_impl/tbe/sqrt_grad.py +0 -43
  1102. mindspore/ops/_op_impl/tbe/sqrt_grad_ds.py +0 -44
  1103. mindspore/ops/_op_impl/tbe/square.py +0 -38
  1104. mindspore/ops/_op_impl/tbe/square_ds.py +0 -39
  1105. mindspore/ops/_op_impl/tbe/square_sum_all.py +0 -40
  1106. mindspore/ops/_op_impl/tbe/square_sum_all_ds.py +0 -41
  1107. mindspore/ops/_op_impl/tbe/square_sum_v1.py +0 -38
  1108. mindspore/ops/_op_impl/tbe/square_sum_v1_ds.py +0 -39
  1109. mindspore/ops/_op_impl/tbe/square_sum_v2.py +0 -39
  1110. mindspore/ops/_op_impl/tbe/squared_difference.py +0 -39
  1111. mindspore/ops/_op_impl/tbe/squared_difference_ds.py +0 -41
  1112. mindspore/ops/_op_impl/tbe/squeeze.py +0 -37
  1113. mindspore/ops/_op_impl/tbe/strided_read.py +0 -38
  1114. mindspore/ops/_op_impl/tbe/strided_slice_d.py +0 -44
  1115. mindspore/ops/_op_impl/tbe/strided_slice_ds.py +0 -71
  1116. mindspore/ops/_op_impl/tbe/strided_slice_grad_d.py +0 -51
  1117. mindspore/ops/_op_impl/tbe/strided_slice_grad_ds.py +0 -57
  1118. mindspore/ops/_op_impl/tbe/strided_write.py +0 -38
  1119. mindspore/ops/_op_impl/tbe/sub.py +0 -39
  1120. mindspore/ops/_op_impl/tbe/sub_ds.py +0 -40
  1121. mindspore/ops/_op_impl/tbe/tan.py +0 -38
  1122. mindspore/ops/_op_impl/tbe/tan_ds.py +0 -39
  1123. mindspore/ops/_op_impl/tbe/tanh.py +0 -37
  1124. mindspore/ops/_op_impl/tbe/tanh_ds.py +0 -38
  1125. mindspore/ops/_op_impl/tbe/tanh_grad.py +0 -39
  1126. mindspore/ops/_op_impl/tbe/tanh_grad_ds.py +0 -40
  1127. mindspore/ops/_op_impl/tbe/tensor_move.py +0 -49
  1128. mindspore/ops/_op_impl/tbe/tensor_move_ds.py +0 -50
  1129. mindspore/ops/_op_impl/tbe/tensor_scatter_update.py +0 -41
  1130. mindspore/ops/_op_impl/tbe/tile.py +0 -37
  1131. mindspore/ops/_op_impl/tbe/tile_ds.py +0 -42
  1132. mindspore/ops/_op_impl/tbe/top_k.py +0 -42
  1133. mindspore/ops/_op_impl/tbe/top_k_ds.py +0 -43
  1134. mindspore/ops/_op_impl/tbe/trans_data.py +0 -167
  1135. mindspore/ops/_op_impl/tbe/trans_data_ds.py +0 -180
  1136. mindspore/ops/_op_impl/tbe/trans_data_rnn.py +0 -44
  1137. mindspore/ops/_op_impl/tbe/transpose.py +0 -60
  1138. mindspore/ops/_op_impl/tbe/transpose_d.py +0 -47
  1139. mindspore/ops/_op_impl/tbe/transpose_nod.py +0 -60
  1140. mindspore/ops/_op_impl/tbe/trunc.py +0 -39
  1141. mindspore/ops/_op_impl/tbe/truncate_div.py +0 -41
  1142. mindspore/ops/_op_impl/tbe/truncate_div_ds.py +0 -42
  1143. mindspore/ops/_op_impl/tbe/truncate_mod.py +0 -41
  1144. mindspore/ops/_op_impl/tbe/truncate_mod_ds.py +0 -42
  1145. mindspore/ops/_op_impl/tbe/unpack.py +0 -38
  1146. mindspore/ops/_op_impl/tbe/unpack_ds.py +0 -39
  1147. mindspore/ops/_op_impl/tbe/unsorted_segment_max.py +0 -49
  1148. mindspore/ops/_op_impl/tbe/unsorted_segment_max_ds.py +0 -40
  1149. mindspore/ops/_op_impl/tbe/unsorted_segment_min.py +0 -49
  1150. mindspore/ops/_op_impl/tbe/unsorted_segment_min_ds.py +0 -40
  1151. mindspore/ops/_op_impl/tbe/unsorted_segment_prod.py +0 -49
  1152. mindspore/ops/_op_impl/tbe/unsorted_segment_prod_ds.py +0 -38
  1153. mindspore/ops/_op_impl/tbe/unsorted_segment_sum.py +0 -38
  1154. mindspore/ops/_op_impl/tbe/unsorted_segment_sum_ds.py +0 -41
  1155. mindspore/ops/_op_impl/tbe/wts_arq.py +0 -40
  1156. mindspore/ops/_op_impl/tbe/xdivy.py +0 -38
  1157. mindspore/ops/_op_impl/tbe/xdivy_ds.py +0 -39
  1158. mindspore/ops/_op_impl/tbe/xlogy.py +0 -38
  1159. mindspore/ops/_op_impl/tbe/xlogy_ds.py +0 -39
  1160. mindspore/ops/_op_impl/tbe/zeros_like.py +0 -41
  1161. mindspore/ops/_op_impl/tbe/zeros_like_ds.py +0 -42
  1162. mindspore/ops/_tracefunc.py +0 -241
  1163. mindspore/ops/arg_dtype_cast.py +0 -54
  1164. mindspore/rewrite/api/tree_node_helper.py +0 -60
  1165. mindspore/rewrite/ast_creator_register.py +0 -37
  1166. mindspore/rewrite/ast_helpers/ast_creator.py +0 -115
  1167. mindspore/rewrite/ast_transformers/flatten_recursive_stmt.py +0 -267
  1168. mindspore/rewrite/ast_transformers/remove_return_out_of_if.py +0 -228
  1169. mindspore/rewrite/namespace.py +0 -53
  1170. {mindspore-2.2.11.dist-info → mindspore-2.3.0rc1.dist-info}/WHEEL +0 -0
  1171. {mindspore-2.2.11.dist-info → mindspore-2.3.0rc1.dist-info}/top_level.txt +0 -0
@@ -34,6 +34,7 @@ from mindspore._c_expression import Tensor as Tensor_
34
34
  from mindspore import _checkparam as validator
35
35
  from mindspore._checkparam import check_is_number, is_stub_tensor
36
36
  from mindspore._check_jit_forbidden_api import jit_forbidden_register
37
+ from mindspore.common.symbol import Symbol
37
38
 
38
39
  np_types = (np.int8, np.int16, np.int32, np.int64,
39
40
  np.uint8, np.uint16, np.uint32, np.uint64, np.float16,
@@ -82,11 +83,11 @@ def tensor(input_data=None, dtype=None, shape=None, init=None, internal=False, c
82
83
  based on the `dtype` argument.
83
84
 
84
85
  Please refer to `Creating and Using Tensor
85
- <https://www.mindspore.cn/docs/en/r2.2/note/static_graph_syntax_support.html#mindspore-user-defined-data-types>`_ .
86
+ <https://www.mindspore.cn/docs/en/r2.3.q1/note/static_graph_syntax_support.html#mindspore-user-defined-data-types>`_ .
86
87
 
87
88
  The difference between it and the Tensor class is that it adds
88
89
  `Annotation
89
- <https://www.mindspore.cn/docs/en/r2.2/design/dynamic_graph_and_static_graph.html?#annotation-type>`_
90
+ <https://www.mindspore.cn/docs/en/r2.3.q1/design/dynamic_graph_and_static_graph.html?#annotation-type>`_
90
91
  which can prevent the generation of AnyType compared to the Tensor class.
91
92
 
92
93
  The arguments and return values are the same as the Tensor class. Also see: :class:`mindspore.Tensor`.
@@ -114,22 +115,25 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
114
115
  Tensor is a data structure that stores an n-dimensional array.
115
116
 
116
117
  Note:
117
- If 'init' interface is used to initialize Tensor, the `Tensor.init_data` API needs to be called to load the
118
+ If `init` interface is used to initialize `Tensor`, the `Tensor.init_data` API needs to be called to load the
118
119
  actual data to `Tensor`.
119
120
 
121
+ Warning:
122
+ To convert dtype of a `Tensor`, it is recommended to use `Tensor.astype()` rather than
123
+ `Tensor(sourceTensor, dtype=newDtype)`.
124
+
120
125
  Args:
121
126
  input_data (Union[Tensor, float, int, bool, tuple, list, numpy.ndarray]): The data to be stored. It can be
122
127
  another Tensor, Python number or NumPy ndarray. Default: ``None`` .
123
128
  dtype (:class:`mindspore.dtype`): Used to indicate the data type of the output Tensor. The argument should
124
129
  be defined in `mindspore.dtype`. If it is ``None`` , the data type of the output Tensor will be the same
125
130
  as the `input_data`. Default: ``None`` .
126
- shape (Union[tuple, list, int]): Used to indicate the shape of the output Tensor. The argument should be
127
- a list of integers, a tuple of integers or an integer. If `input_data` is available,
128
- `shape` doesn't need to be set. If None in shape, a tensor of dynamic shape is created, `input_data`
129
- doesn't need to be set; if None not in shape, a tensor of static shape is created, `input_data` or `init`
130
- must be set. Default: ``None`` .
131
+ shape (Union[tuple, list, int, :class:`mindspore.Symbol`]): Used to indicate the shape of the output Tensor.
132
+ If `input_data` is available, `shape` doesn't need to be set. If ``None`` or `Symbol` exists in `shape` ,
133
+ a tensor of dynamic shape is created, `input_data` doesn't need to be set; if only integers exist in
134
+ `shape`, a tensor of static shape is created, `input_data` or `init` must be set. Default: ``None`` .
131
135
  init (Initializer): The information of init data.
132
- 'init' is used for delayed initialization in parallel mode, when using init, `dtype` and `shape` must be
136
+ `init` is used for delayed initialization in parallel mode, when using init, `dtype` and `shape` must be
133
137
  set. Default: ``None`` .
134
138
  internal (bool): Whether it is created by the framework.
135
139
  ``'True'`` means that the tensor is created by framework.
@@ -142,9 +146,10 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
142
146
  Tensor.
143
147
 
144
148
  Note:
145
- The default value None of `input_data` works as a placeholder, it does not mean that we can create a NoneType
149
+ The default value ``None`` of `input_data` works as a placeholder,
150
+ it does not mean that we can create a NoneType
146
151
  Tensor.
147
- Tensor with shape contains 0 is not fully tested and supported.
152
+ Tensor with `shape` contains 0 is not fully tested and supported.
148
153
 
149
154
  Examples:
150
155
  >>> import numpy as np
@@ -200,6 +205,11 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
200
205
 
201
206
  def __init__(self, input_data=None, dtype=None, shape=None, init=None, internal=False, const_arg=False):
202
207
  self.init_finished = False
208
+ if isinstance(input_data, (Tensor, Tensor_)) and dtype is not None:
209
+ logger.info("It is suggested to use 'Tensor.astype()' to convert the dtype of a Tensor.")
210
+ _cast = tensor_operator_registry.get("cast")
211
+ input_data = _cast(input_data, dtype)
212
+
203
213
  if is_stub_tensor(input_data):
204
214
  input_data = input_data.stub_sync()
205
215
 
@@ -218,8 +228,16 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
218
228
  if isinstance(input_data, np_types):
219
229
  input_data = np.array(input_data)
220
230
 
221
- if isinstance(shape, numbers.Number):
222
- shape = (shape,)
231
+ if shape is not None:
232
+ if isinstance(shape, numbers.Number):
233
+ shape = (shape,)
234
+ elif isinstance(shape, Symbol):
235
+ self.symbolic_shape = [shape]
236
+ shape = (None,)
237
+ elif isinstance(shape, (list, tuple)) and any(isinstance(s, Symbol) for s in shape):
238
+ self.symbolic_shape = [item.to_dict() if isinstance(item, Symbol) else item for item in shape]
239
+ shape_without_symbol = (None if isinstance(item, Symbol) else item for item in shape)
240
+ shape = list(shape_without_symbol) if isinstance(shape, list) else tuple(shape_without_symbol)
223
241
 
224
242
  _check_tensor_input(input_data, dtype, shape, init)
225
243
 
@@ -258,6 +276,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
258
276
  self.slice_num_of_persistent_data_ = None
259
277
  self.slice_shape_of_persistent_data_ = None
260
278
 
279
+ # the auto gradient information
280
+ self._grad = None
281
+ self._grad_fn = None
282
+ self._requires_grad = False
283
+ self._retain_grad = False
284
+
261
285
  @classmethod
262
286
  def __subclasshook__(cls, sub):
263
287
  """
@@ -295,19 +319,11 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
295
319
  def __eq__(self, other):
296
320
  if not isinstance(other, (int, float, Tensor)):
297
321
  return False
298
- # bool type is not supported for `Equal` operator in backend.
299
- if self.dtype == mstype.bool_ or (isinstance(other, Tensor) and other.dtype == mstype.bool_):
300
- if isinstance(other, Tensor):
301
- return Tensor(np.array(self.asnumpy() == other.asnumpy()))
302
- return Tensor(np.array(self.asnumpy() == other))
303
322
  return tensor_operator_registry.get('__eq__')(self, other)
304
323
 
305
324
  def __ne__(self, other):
306
325
  if not isinstance(other, (int, float, Tensor)):
307
326
  return True
308
- # bool type is not supported for `NotEqual` operator in backend.
309
- if self.dtype == mstype.bool_ or (isinstance(other, Tensor) and other.dtype == mstype.bool_):
310
- return Tensor(np.array(self.asnumpy() != other.asnumpy()))
311
327
  return tensor_operator_registry.get('__ne__')(self, other)
312
328
 
313
329
  def __hash__(self):
@@ -322,11 +338,14 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
322
338
  return out
323
339
 
324
340
  def __round__(self):
325
- out = tensor_operator_registry.get('round')()(self)
341
+ out = tensor_operator_registry.get('round')(self)
326
342
  return out
327
343
 
328
344
  def __bool__(self):
329
- data = self.asnumpy()
345
+ if self.dtype == mstype.bfloat16:
346
+ data = self.float().asnumpy()
347
+ else:
348
+ data = self.asnumpy()
330
349
  if data.shape == ():
331
350
  return bool(data)
332
351
  if data.shape == (1,):
@@ -342,15 +361,24 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
342
361
  raise ValueError(message)
343
362
 
344
363
  def __int__(self):
345
- data = self.asnumpy()
364
+ if self.dtype == mstype.bfloat16:
365
+ data = self.float().asnumpy()
366
+ else:
367
+ data = self.asnumpy()
346
368
  return self._convert_scalar_(data, int, "Only one element tensors can be converted to Python scalars")
347
369
 
348
370
  def __float__(self):
349
- data = self.asnumpy()
371
+ if self.dtype == mstype.bfloat16:
372
+ data = self.float().asnumpy()
373
+ else:
374
+ data = self.asnumpy()
350
375
  return self._convert_scalar_(data, float, "Only one element tensors can be converted to Python scalars")
351
376
 
352
377
  def __index__(self):
353
- data = self.asnumpy()
378
+ if self.dtype == mstype.bfloat16:
379
+ data = self.float().asnumpy()
380
+ else:
381
+ data = self.asnumpy()
354
382
  if data.dtype not in ["int8", "int16", "int32", "int64", "bool"]:
355
383
  raise ValueError("Only integer tensors of a single element can be converted to an index.")
356
384
  return self._convert_scalar_(data, int,
@@ -360,7 +388,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
360
388
  return self
361
389
 
362
390
  def __abs__(self):
363
- self._init_check()
364
391
  return tensor_operator_registry.get('abs')(self)
365
392
 
366
393
  def __add__(self, other):
@@ -544,6 +571,83 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
544
571
  """
545
572
  return len(self._shape)
546
573
 
574
+ @property
575
+ def grad(self):
576
+ r"""
577
+ Get the gradient value.
578
+ """
579
+ return self._grad
580
+
581
+ @grad.setter
582
+ def grad(self, grad):
583
+ r"""
584
+ Set the gradient value.
585
+ """
586
+ self._grad = grad
587
+
588
+ @property
589
+ def grad_fn(self):
590
+ r"""
591
+ The function for backward.
592
+ """
593
+ return self._grad_fn
594
+
595
+ @grad_fn.setter
596
+ def grad_fn(self, grad_fn):
597
+ r"""
598
+ Set the function for backward.
599
+ """
600
+ self._grad_fn = grad_fn
601
+
602
+ @property
603
+ def is_leaf(self):
604
+ r"""
605
+ Whether the stub tensor is leaf.
606
+ They will be a leaf if they have requires_grad and requires_grad is False,
607
+ Or they were created by user.
608
+ """
609
+ return self._requires_grad is False or self._grad_fn is None
610
+
611
+ @property
612
+ def requires_grad(self):
613
+ r"""
614
+ Whether the stub tensor need requires grad.
615
+ """
616
+ return self._requires_grad
617
+
618
+ @requires_grad.setter
619
+ def requires_grad(self, requires_grad):
620
+ r"""
621
+ Mark the stub tensor whether need requires gradient.
622
+ """
623
+ self._requires_grad = requires_grad
624
+
625
+ def retain_grad(self):
626
+ r"""
627
+ Enable the stub tensor which is not non-leaf to have the grad during backward().
628
+ """
629
+ if not self._requires_grad:
630
+ RuntimeError("can't retain_grad on Tensor that has requires_grad = False.")
631
+ self._retain_grad = self._grad_fn is not None
632
+
633
+ @property
634
+ def retains_grad(self):
635
+ r"""
636
+ Is True if the stub tensor is non-leaf and its grad is enabled to be populated during backward().
637
+ """
638
+ return self._retain_grad
639
+
640
+ def backward(self, grad=None):
641
+ r"""
642
+ Calculate the gradient.
643
+ """
644
+ if grad is None:
645
+ grad = Tensor(np.ones(self.shape), self.dtype)
646
+ if self._grad_fn is not None:
647
+ self._grad_fn.apply(grad)
648
+ elif self._requires_grad:
649
+ self._grad = grad
650
+
547
651
  @property
548
652
  def H(self):
549
653
  """
@@ -644,6 +748,8 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
644
748
  [[1 3]
645
749
  [2 4]]
646
750
  """
751
+ if self.ndim <= 1:
752
+ return self
647
753
  return self.transpose()
648
754
 
649
755
  @staticmethod
@@ -710,28 +816,24 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
710
816
  r"""
711
817
  For details, please refer to :func:`mindspore.ops.arccosh`.
712
818
  """
713
- self._init_check()
714
819
  return tensor_operator_registry.get('acosh')(self)
715
820
 
716
821
  def arcsin(self):
717
822
  r"""
718
823
  For details, please refer to :func:`mindspore.ops.arcsin`.
719
824
  """
720
- self._init_check()
721
825
  return tensor_operator_registry.get('asin')(self)
722
826
 
723
827
  def arctan(self):
724
828
  r"""
725
829
  For details, please refer to :func:`mindspore.ops.arctan`.
726
830
  """
727
- self._init_check()
728
831
  return tensor_operator_registry.get('atan')(self)
729
832
 
730
833
  def arctan2(self, other):
731
834
  r"""
732
835
  For details, please refer to :func:`mindspore.ops.arctan2`.
733
836
  """
734
- self._init_check()
735
837
  return tensor_operator_registry.get('atan2')(self, other)
736
838
 
737
839
  def cauchy(self, median=0.0, sigma=1.0):
@@ -766,7 +868,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
766
868
  [[8.79836142e-01, 9.37541723e-01]])
767
869
 
768
870
  """
769
- self._init_check()
770
871
  out = tensor_operator_registry.get('cauchy')(list(self.shape), median, sigma)()
771
872
  return out.astype(self.dtype)
772
873
 
@@ -804,7 +905,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
804
905
  [[1.2788825 2.3305743]
805
906
  [14.944194 0.16303174]]
806
907
  """
807
- self._init_check()
808
908
  return tensor_operator_registry.get('log_normal')(mean, std)(self)
809
909
 
810
910
  @jit_forbidden_register
@@ -837,29 +937,23 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
837
937
  r"""
838
938
  For details, please refer to :func:`mindspore.ops.bincount`.
839
939
  """
840
- self._init_check()
841
940
  return tensor_operator_registry.get('bincount')(self, weights, minlength)
842
941
 
843
942
  def chunk(self, chunks, axis=0):
844
943
  r"""
845
944
  For details, please refer to :func:`mindspore.ops.chunk`.
846
945
  """
847
- self._init_check()
848
946
  return tensor_operator_registry.get('chunk')(self, chunks, axis)
849
947
 
850
948
  def item(self, index=None):
851
949
  """
852
950
  Get the item at the specified index of the tensor.
853
951
 
854
- Note:
855
- Tensor.item returns a Tensor scalar instead of a Python scalar. And if the tensor is a Tensor scalar,
856
- Tensor.item will return the numpy.ndarray.
857
-
858
952
  Args:
859
953
  index (Union[None, int, tuple(int)]): The index in Tensor. Default: ``None``.
860
954
 
861
955
  Returns:
862
- A Tensor scalar, dtype is the same with the original Tensor.
956
+ A scalar, type is defined by the dtype of the Tensor.
863
957
 
864
958
  Raises:
865
959
  ValueError: If the length of the `index` is not equal to self.ndim.
@@ -877,7 +971,11 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
877
971
  >>> print(x.item())
878
972
  1.2
879
973
  """
880
- output = tensor_operator_registry.get('item')(self, index)
974
+
975
+ if index is not None:
976
+ output = self.asnumpy().item(index)
977
+ else:
978
+ output = self.asnumpy().item()
881
979
  return output
882
980
 
883
981
  def itemset(self, *args):
@@ -936,7 +1034,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
936
1034
  >>> print(x.get_bytes())
937
1035
  b'\x01\x00\x02\x00\x03\x00'
938
1036
  """
939
- self._init_check()
940
1037
  return Tensor_.get_bytes(self)
941
1038
 
942
1039
  def asnumpy(self):
@@ -958,9 +1055,8 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
958
1055
  >>> print(y)
959
1056
  [11. 2.]
960
1057
  """
961
- self._init_check()
962
- if self.dtype == mstype.bfloat16:
963
- raise TypeError(f"For asnumpy, the type of tensor cannot be BFloat16, but got {self.dtype}.")
1058
+ if self.has_init:
1059
+ self.init_data()
964
1060
  return Tensor_.asnumpy(self)
965
1061
 
966
1062
  def numpy(self):
@@ -1004,21 +1100,18 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1004
1100
  """
1005
1101
  For details, please refer to :func:`mindspore.ops.slice_scatter`.
1006
1102
  """
1007
- self._init_check()
1008
1103
  return tensor_operator_registry.get('slice_scatter')(self, src, axis, start, end, step)
1009
1104
 
1010
1105
  def select_scatter(self, src, axis, index):
1011
1106
  """
1012
1107
  For details, please refer to :func:`mindspore.ops.select_scatter`.
1013
1108
  """
1014
- self._init_check()
1015
1109
  return tensor_operator_registry.get('select_scatter')(self, src, axis, index)
1016
1110
 
1017
1111
  def histc(self, bins=100, min=0., max=0.):
1018
1112
  """
1019
1113
  For details, please refer to :func:`mindspore.ops.histc`.
1020
1114
  """
1021
- self._init_check()
1022
1115
  validator.check_value_type('min', min, (int, float,), 'Tensor.histc')
1023
1116
  validator.check_value_type('max', max, (int, float,), 'Tensor.histc')
1024
1117
  return tensor_operator_registry.get('histc')(self, bins, float(min), float(max))
@@ -1027,7 +1120,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1027
1120
  """
1028
1121
  For details, please refer to :func:`mindspore.ops.geqrf`.
1029
1122
  """
1030
- self._init_check()
1031
1123
  return tensor_operator_registry.get('geqrf')(self)
1032
1124
 
1033
1125
  def slice_shape_of_persistent_data(self):
@@ -1069,14 +1161,11 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1069
1161
  >>> from mindspore import Tensor, ops
1070
1162
  >>> x = Tensor([[1, 2, 3], [4, 5, 6]], dtype=ms.float32)
1071
1163
  >>> y = ops.transpose(x, (1, 0))
1072
- >>> y.contiguous()
1073
- >>> y[:, 1] = 1
1074
- >>> print(x)
1075
- [[1. 2. 3.]
1076
- [4. 5. 6.]]
1164
+ >>> z = y.contiguous()
1165
+ >>> print(z.is_contiguous())
1166
+ True
1077
1167
  """
1078
- Tensor_.contiguous(self)
1079
- return self
1168
+ return tensor_operator_registry.get('contiguous')(self)
1080
1169
 
1081
1170
  def is_contiguous(self):
1082
1171
  """
@@ -1096,6 +1185,47 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1096
1185
  """
1097
1186
  return Tensor_.is_contiguous(self)
1098
1187
 
1188
+ def stride(self, dim=None):
1189
+ """
1190
+ The stride to jump from one element to the next in the input dim.
1191
+ When no parameters are passed in, a list of stride for all dimensions is returned.
1192
+
1193
+ Args:
1194
+ dim (int): The dim of stride from one element to the next.
1195
+
1196
+ Returns:
1197
+ Int, the stride of tensor.
1198
+
1199
+ Raises:
1200
+ TypeError: `dim` is not an int.
1201
+
1202
+ Examples:
1203
+ >>> import mindspore as ms
1204
+ >>> x = ms.Tensor([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]], dtype=ms.float32)
1205
+ >>> x.stride()
1206
+ [5, 1]
1207
+ """
1208
+ stride = Tensor_.stride(self)
1209
+ if dim is None:
1210
+ return stride
1211
+ return stride[dim]
1212
+
1213
+ def storage_offset(self):
1214
+ """
1215
+ Tensor's offset in the underlying storage in terms of the number of storage elements.
1216
+
1217
+ Returns:
1218
+ int, tensor's offset in the underlying storage in terms of number of storage elements.
1219
+
1220
+ Examples:
1221
+ >>> import mindspore as ms
1222
+ >>> x = ms.Tensor([1, 2, 3, 4, 5], dtype=ms.float32)
1223
+ >>> ret = x.storage_offset()
1224
+ >>> print(ret)
1225
+ 0
1226
+ """
1227
+ return Tensor_.storage_offset(self)
1228
+
1099
1229
  def flush_from_cache(self):
1100
1230
  """
1101
1231
  Flush cache data to host if tensor is cache enable.
@@ -1108,35 +1238,30 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1108
1238
  >>> print(y)
1109
1239
  None
1110
1240
  """
1111
- self._init_check()
1112
1241
  Tensor_._flush_from_cache(self)
1113
1242
 
1114
1243
  def addcdiv(self, tensor1, tensor2, value=1):
1115
1244
  r"""
1116
1245
  For details, please refer to :func:`mindspore.ops.addcdiv`.
1117
1246
  """
1118
- self._init_check()
1119
- return tensor_operator_registry.get('addcdiv')()(self, tensor1, tensor2, value)
1247
+ return tensor_operator_registry.get('addcdiv')(self, tensor1, tensor2, value)
1120
1248
 
1121
1249
  def addcmul(self, tensor1, tensor2, value=1):
1122
1250
  r"""
1123
1251
  For details, please refer to :func:`mindspore.ops.addcmul`.
1124
1252
  """
1125
- self._init_check()
1126
- return tensor_operator_registry.get('addcmul')()(self, tensor1, tensor2, value)
1253
+ return tensor_operator_registry.get('addcmul')(self, tensor1, tensor2, value)
1127
1254
 
1128
1255
  def add(self, other):
1129
1256
  r"""
1130
1257
  For details, please refer to :func:`mindspore.ops.add`.
1131
1258
  """
1132
- self._init_check()
1133
- return tensor_operator_registry.get('add')()(self, other)
1259
+ return tensor_operator_registry.get('add')(self, other)
1134
1260
 
1135
1261
  def subtract(self, other, *, alpha=1):
1136
1262
  r"""
1137
1263
  For details, please refer to :func:`mindspore.ops.subtract`.
1138
1264
  """
1139
- self._init_check()
1140
1265
  return tensor_operator_registry.get('sub')(self, alpha * other)
1141
1266
 
1142
1267
  def true_divide(self, value):
@@ -1144,7 +1269,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1144
1269
  Alias for Tensor.div() with :math:`rounding\_mode=None`.
1145
1270
  For details, please refer to :func:`mindspore.ops.div`.
1146
1271
  """
1147
- self._init_check()
1148
1272
  return tensor_operator_registry.get('div')(self, value, rounding_mode=None)
1149
1273
 
1150
1274
  def triu(self, diagonal=0):
@@ -1155,7 +1279,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1155
1279
  This is an experimental API that is subject to change or deletion.
1156
1280
 
1157
1281
  """
1158
- self._init_check()
1159
1282
  validator.check_value_type('diagonal', diagonal, [int], 'triu')
1160
1283
  return tensor_operator_registry.get('triu')(self, diagonal)
1161
1284
 
@@ -1163,65 +1286,56 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1163
1286
  r"""
1164
1287
  For details, please refer to :func:`mindspore.ops.addbmm`.
1165
1288
  """
1166
- self._init_check()
1167
1289
  return tensor_operator_registry.get('addbmm')(self, batch1, batch2, beta=beta, alpha=alpha)
1168
1290
 
1169
1291
  def addmm(self, mat1, mat2, *, beta=1, alpha=1):
1170
1292
  r"""
1171
1293
  For details, please refer to :func:`mindspore.ops.addmm`.
1172
1294
  """
1173
- self._init_check()
1174
1295
  return tensor_operator_registry.get('addmm')(self, mat1, mat2, beta=beta, alpha=alpha)
1175
1296
 
1176
1297
  def addr(self, vec1, vec2, beta=1, alpha=1):
1177
1298
  r"""
1178
1299
  For details, please refer to :func:`mindspore.ops.addr`.
1179
1300
  """
1180
- self._init_check()
1181
1301
  return tensor_operator_registry.get('addr')(self, vec1, vec2, beta=beta, alpha=alpha)
1182
1302
 
1183
1303
  def adjoint(self):
1184
1304
  r"""
1185
1305
  For details, please refer to :func:`mindspore.ops.adjoint`.
1186
1306
  """
1187
- self._init_check()
1188
1307
  return tensor_operator_registry.get('adjoint')(self)
1189
1308
 
1190
1309
  def all(self, axis=None, keep_dims=False):
1191
1310
  r"""
1192
1311
  For details, please refer to :func:`mindspore.ops.all`.
1193
1312
  """
1194
- self._init_check()
1195
1313
  return tensor_operator_registry.get('all')(self, axis, keep_dims)
1196
1314
 
1197
1315
  def angle(self):
1198
1316
  r"""
1199
1317
  For details, please refer to :func:`mindspore.ops.angle`.
1200
1318
  """
1201
- self._init_check()
1202
1319
  return tensor_operator_registry.get('angle')(self)
1203
1320
 
1204
1321
  def any(self, axis=None, keep_dims=False):
1205
1322
  r"""
1206
1323
  For details, please refer to :func:`mindspore.ops.any`.
1207
1324
  """
1208
- self._init_check()
1209
1325
  if axis is None:
1210
1326
  axis = ()
1211
- return tensor_operator_registry.get('any')(keep_dims)(self, axis)
1327
+ return tensor_operator_registry.get('any')(self, axis, keep_dims)
1212
1328
 
1213
1329
  def atan2(self, other):
1214
1330
  r"""
1215
1331
  For details, please refer to :func:`mindspore.ops.atan2`.
1216
1332
  """
1217
- self._init_check()
1218
1333
  return tensor_operator_registry.get('atan2')(self, other)
1219
1334
 
1220
1335
  def baddbmm(self, batch1, batch2, beta=1, alpha=1):
1221
1336
  r"""
1222
1337
  For details, please refer to :func:`mindspore.ops.baddbmm`.
1223
1338
  """
1224
- self._init_check()
1225
1339
  return tensor_operator_registry.get('baddbmm')(self, batch1, batch2, beta=beta, alpha=alpha)
1226
1340
 
1227
1341
  def view(self, *shape):
@@ -1245,7 +1359,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1245
1359
  [3. 2.]
1246
1360
  [3. 4.]]
1247
1361
  """
1248
- self._init_check()
1249
1362
  if not shape:
1250
1363
  raise ValueError("The shape variable should not be empty")
1251
1364
  if isinstance(shape[0], tuple):
@@ -1279,7 +1392,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1279
1392
  >>> print(output)
1280
1393
  [1. 2. 3. 2. 3. 4.]
1281
1394
  """
1282
- self._init_check()
1283
1395
  if not isinstance(other, (Tensor, Tensor_)):
1284
1396
  raise TypeError(f"For view_as, the input other must be a Tensor, but got {type(other)}")
1285
1397
  return self.view(other.shape)
@@ -1288,42 +1400,36 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1288
1400
  r"""
1289
1401
  For details, please refer to :func:`mindspore.ops.t`.
1290
1402
  """
1291
- self._init_check()
1292
1403
  return tensor_operator_registry.get("t")(self)
1293
1404
 
1294
1405
  def bitwise_and(self, other):
1295
1406
  """
1296
1407
  For details, please refer to :func:`mindspore.ops.bitwise_and`.
1297
1408
  """
1298
- self._init_check()
1299
1409
  return tensor_operator_registry.get('bitwise_and')(self, other)
1300
1410
 
1301
1411
  def bitwise_or(self, other):
1302
1412
  """
1303
1413
  For details, please refer to :func:`mindspore.ops.bitwise_or`.
1304
1414
  """
1305
- self._init_check()
1306
1415
  return tensor_operator_registry.get('bitwise_or')(self, other)
1307
1416
 
1308
1417
  def bitwise_xor(self, other):
1309
1418
  """
1310
1419
  For details, please refer to :func:`mindspore.ops.bitwise_xor`.
1311
1420
  """
1312
- self._init_check()
1313
1421
  return tensor_operator_registry.get('bitwise_xor')(self, other)
1314
1422
 
1315
1423
  def bitwise_left_shift(self, other):
1316
1424
  """
1317
1425
  For details, please refer to :func:`mindspore.ops.bitwise_left_shift`.
1318
1426
  """
1319
- self._init_check()
1320
1427
  return tensor_operator_registry.get('bitwise_left_shift')(self, other)
1321
1428
 
1322
1429
  def bitwise_right_shift(self, other):
1323
1430
  """
1324
1431
  For details, please refer to :func:`mindspore.ops.bitwise_right_shift`.
1325
1432
  """
1326
- self._init_check()
1327
1433
  _cast = tensor_operator_registry.get('cast')
1328
1434
  other = _cast(other, self.dtype)
1329
1435
  return tensor_operator_registry.get('bitwise_right_shift')(self, other)
@@ -1332,50 +1438,43 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1332
1438
  """
1333
1439
  For details, please refer to :func:`mindspore.ops.scatter`.
1334
1440
  """
1335
- self._init_check()
1336
1441
  return tensor_operator_registry.get('scatter')(self, axis, index, src)
1337
1442
 
1338
1443
  def scatter_mul(self, indices, updates):
1339
1444
  """
1340
1445
  For details, please refer to :func:`mindspore.ops.scatter_mul`.
1341
1446
  """
1342
- self._init_check()
1343
1447
  return tensor_operator_registry.get('tensor_scatter_mul')(self, indices, updates)
1344
1448
 
1345
1449
  def scatter_div(self, indices, updates):
1346
1450
  """
1347
1451
  For details, please refer to :func:`mindspore.ops.scatter_div`.
1348
1452
  """
1349
- self._init_check()
1350
1453
  return tensor_operator_registry.get('tensor_scatter_div')(self, indices, updates)
1351
1454
 
1352
1455
  def ger(self, vec2):
1353
1456
  """
1354
1457
  For details, please refer to :func:`mindspore.ops.ger`.
1355
1458
  """
1356
- self._init_check()
1357
1459
  return tensor_operator_registry.get('ger')(self, vec2)
1358
1460
 
1359
1461
  def gt(self, x):
1360
1462
  """
1361
1463
  For details, please refer to :func:`mindspore.ops.gt`.
1362
1464
  """
1363
- self._init_check()
1364
- return tensor_operator_registry.get('gt')()(self, x)
1465
+ return tensor_operator_registry.get('gt')(self, x)
1365
1466
 
1366
1467
  def ge(self, x):
1367
1468
  """
1368
1469
  For details, please refer to :func:`mindspore.ops.ge`.
1369
1470
  """
1370
- self._init_check()
1371
- return tensor_operator_registry.get('ge')()(self, x)
1471
+ return tensor_operator_registry.get('ge')(self, x)
1372
1472
 
1373
1473
  def broadcast_to(self, shape):
1374
1474
  """
1375
1475
  For details, please refer to :func:`mindspore.ops.broadcast_to`.
1376
1476
  """
1377
- self._init_check()
1378
- return tensor_operator_registry.get('broadcast_to')(shape)(self)
1477
+ return tensor_operator_registry.get('broadcast_to')(self, shape)
1379
1478
 
1380
1479
  def expand_as(self, x):
1381
1480
  """
@@ -1399,84 +1498,72 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1399
1498
  [[1. 2. 3.]
1400
1499
  [1. 2. 3.]]
1401
1500
  """
1402
- self._init_check()
1403
- return tensor_operator_registry.get('broadcast_to')(x.shape)(self)
1501
+ return tensor_operator_registry.get('broadcast_to')(self, x.shape)
1404
1502
 
1405
1503
  def exp(self):
1406
1504
  """
1407
1505
  For details, please refer to :func:`mindspore.ops.exp`.
1408
1506
  """
1409
- self._init_check()
1410
1507
  return tensor_operator_registry.get('exp')(self)
1411
1508
 
1412
1509
  def real(self):
1413
1510
  r"""
1414
1511
  For details, please refer to :func:`mindspore.ops.real`.
1415
1512
  """
1416
- self._init_check()
1417
1513
  return tensor_operator_registry.get('real')(self)
1418
1514
 
1419
1515
  def rsqrt(self):
1420
1516
  r"""
1421
1517
  For details, please refer to :func:`mindspore.ops.rsqrt`.
1422
1518
  """
1423
- self._init_check()
1424
1519
  return tensor_operator_registry.get('rsqrt')(self)
1425
1520
 
1426
1521
  def reciprocal(self):
1427
1522
  r"""
1428
1523
  For details, please refer to :func:`mindspore.ops.reciprocal`.
1429
1524
  """
1430
- self._init_check()
1431
1525
  return tensor_operator_registry.get('reciprocal')(self)
1432
1526
 
1433
1527
  def sqrt(self):
1434
1528
  """
1435
1529
  For details, please refer to :func:`mindspore.ops.sqrt`.
1436
1530
  """
1437
- self._init_check()
1438
1531
  return tensor_operator_registry.get('sqrt')(self)
1439
1532
 
1440
1533
  def square(self):
1441
1534
  """
1442
1535
  For details, please refer to :func:`mindspore.ops.square`.
1443
1536
  """
1444
- self._init_check()
1445
1537
  return tensor_operator_registry.get('square')(self)
1446
1538
 
1447
1539
  def sub(self, y):
1448
1540
  r"""
1449
1541
  For details, please refer to :func:`mindspore.ops.sub`.
1450
1542
  """
1451
- self._init_check()
1452
1543
  return tensor_operator_registry.get('sub')(self, y)
1453
1544
 
1454
1545
  def tan(self):
1455
1546
  """
1456
1547
  For details, please refer to :func:`mindspore.ops.tan`.
1457
1548
  """
1458
- self._init_check()
1459
- return tensor_operator_registry.get('tan')()(self)
1549
+ return tensor_operator_registry.get('tan')(self)
1460
1550
 
1461
1551
  def tanh(self):
1462
1552
  r"""
1463
1553
  For details, please refer to :func:`mindspore.ops.tanh`.
1464
1554
  """
1465
- self._init_check()
1466
1555
  return tensor_operator_registry.get('tanh')(self)
1467
1556
 
1468
1557
  def cosh(self):
1469
1558
  r"""
1470
1559
  For details, please refer to :func:`mindspore.ops.cosh`.
1471
1560
  """
1472
- self._init_check()
1473
- return tensor_operator_registry.get('cosh')()(self)
1561
+ return tensor_operator_registry.get('cosh')(self)
1474
1562
 
1475
1563
  def acos(self):
1476
1564
  r"""
1477
1565
  For details, please refer to :func:`mindspore.ops.acos`.
1478
1566
  """
1479
- self._init_check()
1480
1567
  return tensor_operator_registry.get('acos')(self)
1481
1568
 
1482
1569
  def arccos(self):
@@ -1489,35 +1576,30 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1489
1576
  r"""
1490
1577
  For details, please refer to :func:`mindspore.ops.cos`.
1491
1578
  """
1492
- self._init_check()
1493
1579
  return tensor_operator_registry.get('cos')(self)
1494
1580
 
1495
1581
  def cov(self, *, correction=1, fweights=None, aweights=None):
1496
1582
  r"""
1497
1583
  For details, please refer to :func:`mindspore.ops.cov`.
1498
1584
  """
1499
- self._init_check()
1500
1585
  return tensor_operator_registry.get('cov')(self, correction=correction, fweights=fweights, aweights=aweights)
1501
1586
 
1502
1587
  def acosh(self):
1503
1588
  """
1504
1589
  For details, please refer to :func:`mindspore.ops.acosh`.
1505
1590
  """
1506
- self._init_check()
1507
1591
  return tensor_operator_registry.get('acosh')(self)
1508
1592
 
1509
1593
  def asin(self):
1510
1594
  r"""
1511
1595
  For details, please refer to :func:`mindspore.ops.asin`.
1512
1596
  """
1513
- self._init_check()
1514
1597
  return tensor_operator_registry.get('asin')(self)
1515
1598
 
1516
1599
  def abs(self):
1517
1600
  """
1518
1601
  For details, please refer to :func:`mindspore.ops.abs`.
1519
1602
  """
1520
- self._init_check()
1521
1603
  return tensor_operator_registry.get('abs')(self)
1522
1604
 
1523
1605
  def absolute(self):
@@ -1530,14 +1612,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1530
1612
  """
1531
1613
  For details, please refer to :func:`mindspore.ops.ceil`.
1532
1614
  """
1533
- self._init_check()
1534
- return tensor_operator_registry.get('ceil')()(self)
1615
+ return tensor_operator_registry.get('ceil')(self)
1535
1616
 
1536
1617
  def floor(self):
1537
1618
  """
1538
1619
  For details, please refer to :func:`mindspore.ops.floor`.
1539
1620
  """
1540
- self._init_check()
1541
1621
  return tensor_operator_registry.get('floor')(self)
1542
1622
 
1543
1623
  def floor_divide(self, other):
@@ -1547,21 +1627,18 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1547
1627
  .. warning::
1548
1628
  This is an experimental API that is subject to change or deletion.
1549
1629
  """
1550
- self._init_check()
1551
1630
  return tensor_operator_registry.get('floor_divide')(self, other)
1552
1631
 
1553
1632
  def lerp(self, end, weight):
1554
1633
  """
1555
1634
  For details, please refer to :func:`mindspore.ops.lerp`.
1556
1635
  """
1557
- self._init_check()
1558
1636
  return tensor_operator_registry.get('lerp')(self, end, weight)
1559
1637
 
1560
1638
  def negative(self):
1561
1639
  r"""
1562
1640
  For details, please refer to :func:`mindspore.ops.negative`.
1563
1641
  """
1564
- self._init_check()
1565
1642
  return tensor_operator_registry.get("negative")(self)
1566
1643
 
1567
1644
  # pylint: disable=redefined-builtin
@@ -1569,14 +1646,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1569
1646
  """
1570
1647
  For details, please refer to :func:`mindspore.ops.norm`.
1571
1648
  """
1572
- self._init_check()
1573
1649
  return tensor_operator_registry.get('norm')(self, ord, dim, keepdim, dtype=dtype)
1574
1650
 
1575
1651
  def renorm(self, p, axis, maxnorm):
1576
1652
  """
1577
1653
  For details, please refer to :func:`mindspore.ops.renorm`.
1578
1654
  """
1579
- self._init_check()
1580
1655
  return tensor_operator_registry.get("renorm")(self, p, axis, maxnorm)
1581
1656
 
1582
1657
  def approximate_equal(self, other, tolerance=1e-5):
@@ -1586,7 +1661,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1586
1661
  validator.check_isinstance("x", self, Tensor)
1587
1662
  validator.check_isinstance("y", other, Tensor)
1588
1663
  validator.check_isinstance("tolerance", tolerance, float)
1589
- self._init_check()
1590
1664
  input_x = self.copy() if self.dtype == mstype.float32 else self.astype(mstype.float16)
1591
1665
  input_y = other.copy() if other.dtype == mstype.float32 else other.astype(mstype.float16)
1592
1666
  return tensor_operator_registry.get('__lt__')(tensor_operator_registry.get('abs')(
@@ -1597,14 +1671,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1597
1671
  r"""
1598
1672
  For details, please refer to :func:`mindspore.ops.log1p`.
1599
1673
  """
1600
- self._init_check()
1601
1674
  return tensor_operator_registry.get('log1p')(self)
1602
1675
 
1603
1676
  def logit(self, eps=None):
1604
1677
  r"""
1605
1678
  For details, please refer to :func:`mindspore.ops.logit`.
1606
1679
  """
1607
- self._init_check()
1608
1680
  if eps is None:
1609
1681
  eps = -1.0
1610
1682
  validator.check_value_type('eps', eps, (float,), 'Tensor.logit')
@@ -1614,14 +1686,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1614
1686
  r"""
1615
1687
  For details, please refer to :func:`mindspore.ops.logaddexp`.
1616
1688
  """
1617
- self._init_check()
1618
1689
  return tensor_operator_registry.get('logaddexp')(self, other)
1619
1690
 
1620
1691
  def logaddexp2(self, other):
1621
1692
  r"""
1622
1693
  For details, please refer to :func:`mindspore.ops.logaddexp2`.
1623
1694
  """
1624
- self._init_check()
1625
1695
  return tensor_operator_registry.get('logaddexp2')(self, other)
1626
1696
 
1627
1697
  def logcumsumexp(self, axis):
@@ -1631,133 +1701,114 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1631
1701
  .. warning::
1632
1702
  This is an experimental API that is subject to change or deletion.
1633
1703
  """
1634
- self._init_check()
1635
1704
  return tensor_operator_registry.get('logcumsumexp')(self, axis)
1636
1705
 
1637
1706
  def logsumexp(self, axis, keepdims=False):
1638
1707
  r"""
1639
1708
  For details, please refer to :func:`mindspore.ops.logsumexp`.
1640
1709
  """
1641
- self._init_check()
1642
1710
  return tensor_operator_registry.get('logsumexp')(self, axis, keepdims)
1643
1711
 
1644
1712
  def logdet(self):
1645
1713
  r"""
1646
1714
  For details, please refer to :func:`mindspore.ops.logdet`.
1647
1715
  """
1648
- self._init_check()
1649
1716
  return tensor_operator_registry.get('logdet')(self)
1650
1717
 
1651
1718
  def i0(self):
1652
1719
  r"""
1653
1720
  For details, please refer to :func:`mindspore.ops.i0`.
1654
1721
  """
1655
- self._init_check()
1656
1722
  return tensor_operator_registry.get('i0')(self)
1657
1723
 
1658
1724
  def isclose(self, x2, rtol=1e-05, atol=1e-08, equal_nan=False):
1659
1725
  """
1660
1726
  For details, please refer to :func:`mindspore.ops.isclose`.
1661
1727
  """
1662
- self._init_check()
1663
1728
  return tensor_operator_registry.get('isclose')(self, x2, rtol, atol, equal_nan)
1664
1729
 
1665
1730
  def isneginf(self):
1666
1731
  r"""
1667
1732
  For details, please refer to :func:`mindspore.ops.isneginf`.
1668
1733
  """
1669
- self._init_check()
1670
1734
  return tensor_operator_registry.get('isneginf')(self)
1671
1735
 
1672
1736
  def isposinf(self):
1673
1737
  r"""
1674
1738
  For details, please refer to :func:`mindspore.ops.isposinf`.
1675
1739
  """
1676
- self._init_check()
1677
1740
  return tensor_operator_registry.get('isposinf')(self)
1678
1741
 
1679
1742
  def isreal(self):
1680
1743
  r"""
1681
1744
  For details, please refer to :func:`mindspore.ops.isreal`.
1682
1745
  """
1683
- self._init_check()
1684
1746
  return tensor_operator_registry.get('isreal')(self)
1685
1747
 
1686
1748
  def isfinite(self):
1687
1749
  r"""
1688
1750
  For details, please refer to :func:`mindspore.ops.isfinite`.
1689
1751
  """
1690
- self._init_check()
1691
- return tensor_operator_registry.get('isfinite')()(self)
1752
+ return tensor_operator_registry.get('isfinite')(self)
1692
1753
 
1693
1754
  def is_complex(self):
1694
1755
  r"""
1695
1756
  For details, please refer to :func:`mindspore.ops.is_complex`.
1696
1757
  """
1697
- self._init_check()
1698
1758
  return tensor_operator_registry.get('is_complex')(self)
1699
1759
 
1700
1760
  def inv(self):
1701
1761
  r"""
1702
1762
  For details, please refer to :func:`mindspore.ops.inv`.
1703
1763
  """
1704
- self._init_check()
1705
1764
  return tensor_operator_registry.get('inv')(self)
1706
1765
 
1707
1766
  def inverse(self):
1708
1767
  r"""
1709
1768
  For details, please refer to :func:`mindspore.ops.inverse`.
1710
1769
  """
1711
- self._init_check()
1712
1770
  return tensor_operator_registry.get('inverse')(self)
1713
1771
 
1714
1772
  def invert(self):
1715
1773
  r"""
1716
1774
  For details, please refer to :func:`mindspore.ops.invert`.
1717
1775
  """
1718
- self._init_check()
1719
1776
  return tensor_operator_registry.get('invert')(self)
1720
1777
 
1721
1778
  def pow(self, exponent):
1722
1779
  r"""
1723
1780
  For details, please refer to :func:`mindspore.ops.pow`.
1724
1781
  """
1725
- self._init_check()
1726
- return tensor_operator_registry.get('pow')()(self, exponent)
1782
+ return tensor_operator_registry.get('pow')(self, exponent)
1727
1783
 
1728
1784
  def log(self):
1729
1785
  """
1730
1786
  For details, please refer to :func:`mindspore.ops.log`.
1731
1787
  """
1732
- self._init_check()
1733
1788
  return tensor_operator_registry.get('log')(self)
1734
1789
 
1735
1790
  def log10(self):
1736
1791
  r"""
1737
1792
  For details, please refer to :func:`mindspore.ops.log10`.
1738
1793
  """
1739
- self._init_check()
1740
1794
  return tensor_operator_registry.get('log10')(self)
1741
1795
 
1742
1796
  def log2(self):
1743
1797
  r"""
1744
1798
  For details, please refer to :func:`mindspore.ops.log2`.
1745
1799
  """
1746
- self._init_check()
1747
1800
  return tensor_operator_registry.get('log2')(self)
1748
1801
 
1749
1802
  def mean(self, axis=None, keep_dims=False):
1750
1803
  """
1751
1804
  For details, please refer to :func:`mindspore.ops.mean`.
1752
1805
  """
1753
- self._init_check()
1754
1806
  return tensor_operator_registry.get('mean')(self, axis, keep_dims)
1755
1807
 
1756
1808
  def amin(self, axis=None, keepdims=False, *, initial=None, where=None):
1757
1809
  """
1758
1810
  For details, please refer to :func:`mindspore.ops.amin`.
1759
1811
  """
1760
- self._init_check()
1761
1812
  if axis is None:
1762
1813
  axis = ()
1763
1814
  return tensor_operator_registry.get('amin')(self, axis, keepdims, initial=initial, where=where)
@@ -1766,14 +1817,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1766
1817
  """
1767
1818
  For details, please refer to :func:`mindspore.ops.reverse`.
1768
1819
  """
1769
- self._init_check()
1770
- return tensor_operator_registry.get('reverse')(axis)(self)
1820
+ return tensor_operator_registry.get('reverse')(self, axis)
1771
1821
 
1772
1822
  def amax(self, axis=None, keepdims=False, *, initial=None, where=None):
1773
1823
  """
1774
1824
  For details, please refer to :func:`mindspore.ops.amax`.
1775
1825
  """
1776
- self._init_check()
1777
1826
  if axis is None:
1778
1827
  axis = ()
1779
1828
  return tensor_operator_registry.get('amax')(self, axis, keepdims, initial=initial, where=where)
@@ -1782,28 +1831,24 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1782
1831
  r"""
1783
1832
  For details, please refer to :func:`mindspore.ops.aminmax`.
1784
1833
  """
1785
- self._init_check()
1786
1834
  return tensor_operator_registry.get('aminmax')(self, axis=axis, keepdims=keepdims)
1787
1835
 
1788
1836
  def reverse_sequence(self, seq_lengths, seq_dim=0, batch_dim=0):
1789
1837
  """
1790
1838
  For details, please refer to :func:`mindspore.ops.reverse_sequence`.
1791
1839
  """
1792
- self._init_check()
1793
- return tensor_operator_registry.get("reverse_sequence")(seq_dim, batch_dim)(self, seq_lengths)
1840
+ return tensor_operator_registry.get("reverse_sequence")(self, seq_lengths, seq_dim, batch_dim)
1794
1841
 
1795
1842
  def prod(self, axis=None, keep_dims=False):
1796
1843
  """
1797
1844
  For details, please refer to :func:`mindspore.ops.prod`.
1798
1845
  """
1799
- self._init_check()
1800
1846
  return tensor_operator_registry.get('prod')(self, axis, keep_dims)
1801
1847
 
1802
1848
  def select(self, condition, y):
1803
1849
  r"""
1804
1850
  For details, please refer to :func:`mindspore.ops.select`.
1805
1851
  """
1806
- self._init_check()
1807
1852
  if not isinstance(condition, Tensor):
1808
1853
  raise TypeError(f"For 'Tensor.select', the argument 'condition' should be Tensor,"
1809
1854
  f" but got {type(condition)}.")
@@ -1818,7 +1863,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1818
1863
  f" then the tensor type should be float32 but got {self.dtype}")
1819
1864
  input_y = y
1820
1865
  if isinstance(y, (int, float)):
1821
- input_y = tensor_operator_registry.get('zeros_like')()(self) + y
1866
+ input_y = tensor_operator_registry.get('zeros_like')(self) + y
1822
1867
  if isinstance(y, int):
1823
1868
  input_y = tensor_operator_registry.get('cast')(input_y, mstype.int32)
1824
1869
  else:
@@ -1829,22 +1874,46 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1829
1874
  r"""
1830
1875
  For details, please refer to :func:`mindspore.ops.transpose`.
1831
1876
  """
1832
- self._init_check()
1833
1877
  perm = validator.check_transpose_axis(axes, self.ndim)
1834
- return tensor_operator_registry.get('transpose')()(self, perm)
1878
+ return tensor_operator_registry.get('transpose')(self, perm)
1835
1879
 
1836
1880
  def col2im(self, output_size, kernel_size, dilation, padding_value, stride):
1837
1881
  """
1838
1882
  For details, please refer to :func:`mindspore.ops.col2im`.
1839
1883
  """
1840
- self._init_check()
1841
1884
  return tensor_operator_registry.get('col2im')(self, output_size, kernel_size, dilation, padding_value, stride)
1842
1885
 
1843
1886
  def reshape(self, *shape):
1887
+ r"""
1888
+ Rearranges the input Tensor based on the given `shape` .
1889
+
1890
+ The `shape` can only have one -1 at most, in which case it's inferred from the remaining dimensions and
1891
+ the number of elements in the input.
1892
+
1893
+ Args:
1894
+ shape (Union[int, tuple[int], list[int]]): If `shape` is a tuple or list, its elements should be
1895
+ integers, and only constant value is allowed. i.e., :math:`(y_1, y_2, ..., y_S)`.
1896
+
1897
+ Returns:
1898
+ Tensor, If the given `shape` does not contain -1, the `shape` of tensor is :math:`(y_1, y_2, ..., y_S)`.
1899
+ If the k-th position in the given `shape` is -1, the `shape` of tensor is :math:`(y_1, ..., y_{k-1},
1900
+ \frac{\prod_{i=1}^{R}x_{i}}{y_1\times ...\times y_{k-1}\times y_{k+1}\times...\times y_S} , y_{k+1},
1901
+ ..., y_S)`, in where the shape of input tensor is :math:`(x_1, x_2, ..., x_R)`.
1902
+
1903
+ Supported Platforms:
1904
+ ``Ascend`` ``GPU`` ``CPU``
1905
+
1906
+ Examples:
1907
+ >>> import mindspore
1908
+ >>> import numpy as np
1909
+ >>> from mindspore import Tensor, ops
1910
+ >>> input = Tensor(np.array([[-0.1, 0.3, 3.6], [0.4, 0.5, -3.2]]), mindspore.float32)
1911
+ >>> output = input.reshape(3, 2)
1912
+ >>> print(output)
1913
+ [[-0.1 0.3]
1914
+ [ 3.6 0.4]
1915
+ [ 0.5 -3.2]]
1844
1916
  """
1845
- For details, please refer to :func:`mindspore.ops.reshape`.
1846
- """
1847
- self._init_check()
1848
1917
  new_shape = validator.check_reshape_shp(shape)
1849
1918
  return tensor_operator_registry.get('reshape')(self, new_shape)
1850
1919
 
@@ -1873,7 +1942,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1873
1942
  [ 3.6 0.4]
1874
1943
  [ 0.5 -3.2]]
1875
1944
  """
1876
- self._init_check()
1877
1945
  return tensor_operator_registry.get('reshape')(self, other.shape)
1878
1946
 
1879
1947
  def ravel(self):
@@ -1883,13 +1951,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1883
1951
  Returns:
1884
1952
  Tensor, a 1-D tensor, containing the same elements of the input.
1885
1953
 
1886
- Supported Platforms:
1887
- ``Ascend`` ``GPU`` ``CPU``
1888
-
1889
1954
  See also:
1890
- :func:`mindspore.Tensor.reshape`: Give a new shape to a tensor without changing its data.
1955
+ - :func:`mindspore.Tensor.reshape`: Give a new shape to a tensor without changing its data.
1956
+ - :func:`mindspore.Tensor.flatten`: Return a copy of the tensor collapsed into one dimension.
1891
1957
 
1892
- :func:`mindspore.Tensor.flatten`: Return a copy of the tensor collapsed into one dimension.
1958
+ Supported Platforms:
1959
+ ``Ascend`` ``GPU`` ``CPU``
1893
1960
 
1894
1961
  Examples:
1895
1962
  >>> import numpy as np
@@ -1899,7 +1966,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1899
1966
  >>> print(output.shape)
1900
1967
  (24,)
1901
1968
  """
1902
- self._init_check()
1903
1969
  reshape_op = tensor_operator_registry.get('reshape')
1904
1970
  return reshape_op(self, (-1,))
1905
1971
 
@@ -1907,77 +1973,66 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1907
1973
  """
1908
1974
  For details, please refer to :func:`mindspore.ops.round`.
1909
1975
  """
1910
- self._init_check()
1911
- return tensor_operator_registry.get('round')()(self)
1976
+ return tensor_operator_registry.get('round')(self)
1912
1977
 
1913
1978
  def roll(self, shifts, dims):
1914
1979
  """
1915
1980
  For details, please refer to :func:`mindspore.ops.roll`.
1916
1981
  """
1917
- self._init_check()
1918
1982
  return tensor_operator_registry.get('roll')(shifts, dims)(self)
1919
1983
 
1920
1984
  def rot90(self, k, dims):
1921
1985
  r"""
1922
1986
  For details, please refer to :func:`mindspore.ops.rot90`.
1923
1987
  """
1924
- self._init_check()
1925
1988
  return tensor_operator_registry.get('rot90')(self, k, dims)
1926
1989
 
1927
1990
  def deg2rad(self):
1928
1991
  r"""
1929
1992
  For details, please refer to :func:`mindspore.ops.deg2rad`.
1930
1993
  """
1931
- self._init_check()
1932
1994
  return tensor_operator_registry.get('deg2rad')(self)
1933
1995
 
1934
1996
  def dot(self, other):
1935
1997
  r"""
1936
1998
  For details, please refer to :func:`mindspore.ops.dot`.
1937
1999
  """
1938
- self._init_check()
1939
2000
  return tensor_operator_registry.get('dot')(self, other)
1940
2001
 
1941
2002
  def outer(self, vec2):
1942
2003
  r"""
1943
2004
  For details, please refer to :func:`mindspore.ops.outer`.
1944
2005
  """
1945
- self._init_check()
1946
2006
  return tensor_operator_registry.get('outer')(self, vec2)
1947
2007
 
1948
2008
  def rad2deg(self):
1949
2009
  r"""
1950
2010
  For details, please refer to :func:`mindspore.ops.rad2deg`.
1951
2011
  """
1952
- self._init_check()
1953
2012
  return tensor_operator_registry.get('rad2deg')(self)
1954
2013
 
1955
2014
  def copysign(self, other):
1956
2015
  r"""
1957
2016
  For details, please refer to :func:`mindspore.ops.copysign`.
1958
2017
  """
1959
- self._init_check()
1960
2018
  return tensor_operator_registry.get('copysign')(self, other)
1961
2019
 
1962
2020
  def nelement(self):
1963
2021
  r"""
1964
2022
  Alias for :func:`mindspore.Tensor.numel`.
1965
2023
  """
1966
- self._init_check()
1967
2024
  return tensor_operator_registry.get('nelement')(self)
1968
2025
 
1969
2026
  def numel(self):
1970
2027
  r"""
1971
2028
  For details, please refer to :func:`mindspore.ops.numel`.
1972
2029
  """
1973
- self._init_check()
1974
2030
  return tensor_operator_registry.get('numel')(self)
1975
2031
 
1976
2032
  def permute(self, *axis):
1977
2033
  """
1978
2034
  For details, please refer to :func:`mindspore.ops.permute`.
1979
2035
  """
1980
- self._init_check()
1981
2036
  perm = validator.check_transpose_axis(axis, self.ndim)
1982
2037
  return tensor_operator_registry.get('permute')(self, perm)
1983
2038
 
@@ -1985,98 +2040,84 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
1985
2040
  """
1986
2041
  For details, please refer to :func:`mindspore.ops.positive`.
1987
2042
  """
1988
- self._init_check()
1989
2043
  return tensor_operator_registry.get("positive")(self)
1990
2044
 
1991
2045
  def remainder(self, divisor):
1992
2046
  r"""
1993
2047
  For details, please refer to :func:`mindspore.ops.remainder`.
1994
2048
  """
1995
- self._init_check()
1996
2049
  return tensor_operator_registry.get('remainder')(self, divisor)
1997
2050
 
1998
2051
  def flatten(self, order='C', *, start_dim=0, end_dim=-1):
1999
2052
  r"""
2000
2053
  For details, please refer to :func:`mindspore.ops.flatten`.
2001
2054
  """
2002
- self._init_check()
2003
2055
  return tensor_operator_registry.get('flatten')(self, order, start_dim=start_dim, end_dim=end_dim)
2004
2056
 
2005
2057
  def float_power(self, other):
2006
2058
  r"""
2007
2059
  For details, please refer to :func:`mindspore.ops.float_power`.
2008
2060
  """
2009
- self._init_check()
2010
2061
  return tensor_operator_registry.get('float_power')(self, other)
2011
2062
 
2012
2063
  def fmax(self, other):
2013
2064
  r"""
2014
2065
  For details, please refer to :func:`mindspore.ops.fmax`.
2015
2066
  """
2016
- self._init_check()
2017
2067
  return tensor_operator_registry.get('fmax')(self, other)
2018
2068
 
2019
2069
  def fmin(self, other):
2020
2070
  r"""
2021
2071
  For details, please refer to :func:`mindspore.ops.fmin`.
2022
2072
  """
2023
- self._init_check()
2024
2073
  return tensor_operator_registry.get('fmin')(self, other)
2025
2074
 
2026
2075
  def fmod(self, other):
2027
2076
  r"""
2028
2077
  For details, please refer to :func:`mindspore.ops.fmod`.
2029
2078
  """
2030
- self._init_check()
2031
2079
  return tensor_operator_registry.get('fmod')(self, other)
2032
2080
 
2033
2081
  def narrow(self, axis, start, length):
2034
2082
  """
2035
2083
  For details, please refer to :func:`mindspore.ops.narrow`.
2036
2084
  """
2037
- self._init_check()
2038
2085
  return tensor_operator_registry.get('narrow')(self, axis, start, length)
2039
2086
 
2040
2087
  def swapaxes(self, axis0, axis1):
2041
2088
  """
2042
2089
  For details, please refer to :func:`mindspore.ops.swapaxes`.
2043
2090
  """
2044
- self._init_check()
2045
2091
  return tensor_operator_registry.get('swapaxes')(self, axis0, axis1)
2046
2092
 
2047
2093
  def swapdims(self, dim0, dim1):
2048
2094
  """
2049
2095
  For details, please refer to :func:`mindspore.ops.swapdims`.
2050
2096
  """
2051
- self._init_check()
2052
2097
  return tensor_operator_registry.get('swapdims')(self, dim0, dim1)
2053
2098
 
2054
2099
  def squeeze(self, axis=None):
2055
2100
  """
2056
2101
  For details, please refer to :func:`mindspore.ops.squeeze`.
2057
2102
  """
2058
- self._init_check()
2059
2103
  return tensor_operator_registry.get('squeeze')(self, axis)
2060
2104
 
2061
2105
  def slogdet(self):
2062
2106
  """
2063
2107
  For details, please refer to :func:`mindspore.ops.slogdet`.
2064
2108
  """
2065
- self._init_check()
2066
2109
  return tensor_operator_registry.get('slogdet')(self)
2067
2110
 
2068
2111
  def tril(self, diagonal=0):
2069
2112
  """
2070
2113
  For details, please refer to :func:`mindspore.ops.tril`.
2071
2114
  """
2072
- self._init_check()
2073
2115
  return tensor_operator_registry.get('tril')(self, diagonal)
2074
2116
 
2075
2117
  def unsqueeze(self, dim):
2076
2118
  """
2077
2119
  For details, please refer to :func:`mindspore.ops.unsqueeze`.
2078
2120
  """
2079
- self._init_check()
2080
2121
  validator.check_is_int(dim, 'dim')
2081
2122
  validator.check_int_range(dim, -self.ndim - 1, self.ndim + 1, validator.INC_LEFT, 'dim')
2082
2123
  return tensor_operator_registry.get('unsqueeze')(self, dim)
@@ -2085,7 +2126,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2085
2126
  """
2086
2127
  For details, please refer to :func:`mindspore.ops.expand_dims`.
2087
2128
  """
2088
- self._init_check()
2089
2129
  validator.check_is_int(axis, 'axis')
2090
2130
  validator.check_int_range(axis, -self.ndim - 1, self.ndim + 1, validator.INC_LEFT, 'axis')
2091
2131
  return tensor_operator_registry.get('expand_dims')(self, axis)
@@ -2118,7 +2158,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2118
2158
  >>> print(x.dtype)
2119
2159
  Int32
2120
2160
  """
2121
- self._init_check()
2122
2161
  dtype = _check_astype_and_convert(dtype)
2123
2162
  if not copy and dtype == self.dtype:
2124
2163
  return self
@@ -2128,7 +2167,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2128
2167
  """
2129
2168
  For details, please refer to :func:`mindspore.ops.argmax`.
2130
2169
  """
2131
- self._init_check()
2132
2170
  out = tensor_operator_registry.get('argmax')(self, axis, keepdims)
2133
2171
  return out
2134
2172
 
@@ -2136,7 +2174,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2136
2174
  """
2137
2175
  For details, please refer to :func:`mindspore.ops.argmin`.
2138
2176
  """
2139
- self._init_check()
2140
2177
  out = tensor_operator_registry.get('argmin')(self, axis, keepdims)
2141
2178
  return out
2142
2179
 
@@ -2187,7 +2224,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2187
2224
  """
2188
2225
  if self.shape == ():
2189
2226
  return (self, Tensor(0))
2190
- self._init_check()
2191
2227
  return tensor_operator_registry.get('argmax_with_value')(self, axis, keep_dims)
2192
2228
 
2193
2229
  def argmin_with_value(self, axis=0, keep_dims=False):
@@ -2235,7 +2271,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2235
2271
  """
2236
2272
  if self.shape == ():
2237
2273
  return (self, Tensor(0))
2238
- self._init_check()
2239
2274
  return tensor_operator_registry.get('argmin_with_value')(self, axis, keep_dims)
2240
2275
 
2241
2276
  def cumsum(self, axis=None, dtype=None):
@@ -2277,15 +2312,13 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2277
2312
  """
2278
2313
  For details, please refer to :func:`mindspore.ops.index_select`.
2279
2314
  """
2280
- self._init_check()
2281
2315
  return tensor_operator_registry.get('index_select')(self, axis, index)
2282
2316
 
2283
2317
  def inplace_update(self, v, indices):
2284
2318
  """
2285
2319
  For details, please refer to :func:`mindspore.ops.inplace_update`.
2286
2320
  """
2287
- self._init_check()
2288
- return tensor_operator_registry.get('inplace_update')()(self, indices, v)
2321
+ return tensor_operator_registry.get('inplace_update')(self, v, indices)
2289
2322
 
2290
2323
  def copy(self):
2291
2324
  """
@@ -2359,15 +2392,13 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2359
2392
  Raises:
2360
2393
  TypeError: If arguments have types not specified above.
2361
2394
 
2362
- Supported Platforms:
2363
- ``Ascend`` ``GPU`` ``CPU``
2364
-
2365
2395
  See also:
2366
- :func:`mindspore.Tensor.argmin`: Return the indices of the minimum values along an axis.
2367
-
2368
- :func:`mindspore.Tensor.argmax`: Return the indices of the maximum values along an axis.
2396
+ - :func:`mindspore.Tensor.argmin`: Return the indices of the minimum values along an axis.
2397
+ - :func:`mindspore.Tensor.argmax`: Return the indices of the maximum values along an axis.
2398
+ - :func:`mindspore.Tensor.min`: Return the minimum of a tensor or minimum along an axis.
2369
2399
 
2370
- :func:`mindspore.Tensor.min`: Return the minimum of a tensor or minimum along an axis.
2400
+ Supported Platforms:
2401
+ ``Ascend`` ``GPU`` ``CPU``
2371
2402
 
2372
2403
  Examples:
2373
2404
  >>> import numpy as np
@@ -2382,7 +2413,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2382
2413
  >>> print(indices)
2383
2414
  [1 1]
2384
2415
  """
2385
- self._init_check()
2386
2416
  if isinstance(axis, (list, tuple)):
2387
2417
  reduce_ = tensor_operator_registry.get("reduce")
2388
2418
  reduce_max = tensor_operator_registry.get("reduce_max")
@@ -2430,15 +2460,13 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2430
2460
  Raises:
2431
2461
  TypeError: If arguments have types not specified above.
2432
2462
 
2433
- Supported Platforms:
2434
- ``Ascend`` ``GPU`` ``CPU``
2435
-
2436
2463
  See also:
2437
- :func:`mindspore.Tensor.argmin`: Return the indices of the minimum values along an axis.
2464
+ - :func:`mindspore.Tensor.argmin`: Return the indices of the minimum values along an axis.
2465
+ - :func:`mindspore.Tensor.argmax`: Return the indices of the maximum values along an axis.
2466
+ - :func:`mindspore.Tensor.max`: Return the minimum of a tensor or minimum along an axis.
2438
2467
 
2439
- :func:`mindspore.Tensor.argmax`: Return the indices of the maximum values along an axis.
2440
-
2441
- :func:`mindspore.Tensor.max`: Return the minimum of a tensor or minimum along an axis.
2468
+ Supported Platforms:
2469
+ ``Ascend`` ``GPU`` ``CPU``
2442
2470
 
2443
2471
  Examples:
2444
2472
  >>> import numpy as np
@@ -2462,12 +2490,11 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2462
2490
  >>> print(indices)
2463
2491
  [0 0]
2464
2492
  """
2465
- self._init_check()
2466
2493
  if isinstance(axis, (list, tuple)):
2467
2494
  reduce_ = tensor_operator_registry.get("reduce")
2468
2495
  reduce_min = tensor_operator_registry.get("reduce_min")
2469
2496
  minimum = tensor_operator_registry.get("minimum")
2470
- return reduce_(self, reduce_min(keepdims), cmp_fn=minimum(), axis=axis, keepdims=keepdims,
2497
+ return reduce_(self, reduce_min(keepdims), cmp_fn=minimum, axis=axis, keepdims=keepdims,
2471
2498
  initial=initial, where=where)
2472
2499
  values, indices = tensor_operator_registry.get("min")(self, axis, keepdims, initial=initial, where=where)
2473
2500
  if not return_indices:
@@ -2478,7 +2505,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2478
2505
  """
2479
2506
  For details, please refer to :func:`mindspore.ops.scatter_add`.
2480
2507
  """
2481
- self._init_check()
2482
2508
  return tensor_operator_registry.get("tensor_scatter_add")(self, indices, updates)
2483
2509
 
2484
2510
  def scatter_sub(self, indices, updates):
@@ -2491,7 +2517,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2491
2517
 
2492
2518
  The last axis of `indices` is the depth of each index vectors. For each index vector,
2493
2519
  there must be a corresponding value in `updates`. The shape of `updates` should be
2494
- equal to the shape of `self[indices]`. For more details, see use cases.
2520
+ equal to the shape of `self[indices]`. For more details, see Examples.
2495
2521
 
2496
2522
  Note:
2497
2523
  On GPU, if some values of the `indices` are out of bound, instead of raising an index error,
@@ -2526,28 +2552,30 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2526
2552
  [[-3.3000002 0.3 3.6 ]
2527
2553
  [ 0.4 0.5 -3.2 ]]
2528
2554
  """
2529
- self._init_check()
2530
2555
  return tensor_operator_registry.get('tensor_scatter_sub')(self, indices, updates)
2531
2556
 
2532
2557
  def scatter_min(self, indices, updates):
2533
2558
  """
2534
2559
  For details, please refer to :func:`mindspore.ops.scatter_min`.
2535
2560
  """
2536
- self._init_check()
2537
- return tensor_operator_registry.get('tensor_scatter_min')()(self, indices, updates)
2561
+ return tensor_operator_registry.get('tensor_scatter_min')(self, indices, updates)
2538
2562
 
2539
2563
  def scatter_max(self, indices, updates):
2540
2564
  """
2541
2565
  For details, please refer to :func:`mindspore.ops.scatter_max`.
2542
2566
  """
2543
- self._init_check()
2544
- return tensor_operator_registry.get('tensor_scatter_max')()(self, indices, updates)
2567
+ return tensor_operator_registry.get('tensor_scatter_max')(self, indices, updates)
2568
+
2569
+ def softmax(self, axis, dtype=None):
2570
+ """
2571
+ For details, please refer to :func:`mindspore.ops.softmax`.
2572
+ """
2573
+ return tensor_operator_registry.get('softmax')(self, axis, dtype=dtype)
2545
2574
 
2546
2575
  def fill(self, value):
2547
2576
  """
2548
2577
  `Tensor.fill` is deprecated, please use `ops.fill` instead.
2549
2578
  """
2550
- self._init_check()
2551
2579
  if value is None:
2552
2580
  if self.dtype not in (mstype.float16, mstype.float32, mstype.float64):
2553
2581
  raise TypeError("For 'Tensor.fill', if the argument 'value' is None, the type of the original "
@@ -2560,7 +2588,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2560
2588
  """
2561
2589
  `Tensor.fills` is deprecated, please use `ops.fill` instead.
2562
2590
  """
2563
- self._init_check()
2564
2591
  return tensor_operator_registry.get('fills')(self, value)
2565
2592
 
2566
2593
  def fill_diagonal(self, fill_value, wrap=False):
@@ -2602,14 +2629,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2602
2629
  [5. 1. 1.]
2603
2630
  [1. 5. 1.]]
2604
2631
  """
2605
- self._init_check()
2606
2632
  return tensor_operator_registry.get('fill_diagonal')(fill_value, wrap)(self)
2607
2633
 
2608
2634
  def masked_fill(self, mask, value):
2609
2635
  """
2610
2636
  For details, please refer to :func:`mindspore.ops.masked_fill`.
2611
2637
  """
2612
- self._init_check()
2613
2638
  if isinstance(value, (float, int)):
2614
2639
  value = tensor_operator_registry.get("scalar_to_tensor")(value, self.dtype)
2615
2640
  if not isinstance(mask, Tensor):
@@ -2665,13 +2690,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2665
2690
  r"""
2666
2691
  For details, please refer to :func:`mindspore.ops.minimum`.
2667
2692
  """
2668
- return tensor_operator_registry.get('minimum')()(self, other)
2693
+ return tensor_operator_registry.get('minimum')(self, other)
2669
2694
 
2670
2695
  def clamp(self, min=None, max=None):
2671
2696
  r"""
2672
2697
  For details, please refer to :func:`mindspore.ops.clamp`.
2673
2698
  """
2674
- self._init_check()
2675
2699
  return tensor_operator_registry.get('clamp')(self, min, max)
2676
2700
 
2677
2701
  def clip(self, min=None, max=None):
@@ -2680,10 +2704,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2680
2704
  """
2681
2705
  return self.clamp(min, max)
2682
2706
 
2683
- def _init_check(self):
2684
- if self.has_init:
2685
- self.init_data()
2686
-
2687
2707
  def init_data(self, slice_index=None, shape=None, opt_shard_group=None):
2688
2708
  """
2689
2709
  Get the tensor format data of this Tensor.
@@ -2700,7 +2720,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2700
2720
  opt_shard_group(str): Optimizer shard group which is used in auto or semi auto parallel mode
2701
2721
  to get one shard of a parameter's slice. For more information about optimizer parallel, please refer to:
2702
2722
  `Optimizer Parallel
2703
- <https://www.mindspore.cn/tutorials/experts/en/r2.2/parallel/optimizer_parallel.html>`_.
2723
+ <https://www.mindspore.cn/tutorials/experts/en/r2.3.q1/parallel/optimizer_parallel.html>`_.
2704
2724
  Default: ``None``.
2705
2725
 
2706
2726
  Returns:
@@ -2805,13 +2825,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2805
2825
  Returns:
2806
2826
  Tensor.
2807
2827
 
2808
- Supported Platforms:
2809
- ``Ascend`` ``GPU`` ``CPU``
2810
-
2811
2828
  See also:
2812
- :func:`mindspore.Tensor.reshape`: Give a new shape to a tensor without changing its data.
2829
+ - :func:`mindspore.Tensor.reshape`: Give a new shape to a tensor without changing its data.
2830
+ - :func:`mindspore.Tensor.repeat`: Repeat elements of a tensor.
2813
2831
 
2814
- :func:`mindspore.Tensor.repeat`: Repeat elements of a tensor.
2832
+ Supported Platforms:
2833
+ ``Ascend`` ``GPU`` ``CPU``
2815
2834
 
2816
2835
  Examples:
2817
2836
  >>> import numpy as np
@@ -2838,7 +2857,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2838
2857
  diff_size = new_size - cur_size
2839
2858
  if diff_size > 0:
2840
2859
  pad_val = tensor_operator_registry.get('fill')(self.dtype, (diff_size,), 0)
2841
- res = tensor_operator_registry.get('concatenate')(0)((flattened, pad_val))
2860
+ res = tensor_operator_registry.get('concatenate')((flattened, pad_val), 0)
2842
2861
  else:
2843
2862
  res = flattened[:new_size]
2844
2863
  return res.reshape(new_shape)
@@ -2847,70 +2866,60 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2847
2866
  r"""
2848
2867
  For details, please refer to :func:`mindspore.ops.det`.
2849
2868
  """
2850
- self._init_check()
2851
2869
  return tensor_operator_registry.get('det')(self)
2852
2870
 
2853
2871
  def diff(self, n=1, axis=-1, prepend=None, append=None):
2854
2872
  r"""
2855
2873
  For details, please refer to :func:`mindspore.ops.diff`.
2856
2874
  """
2857
- self._init_check()
2858
2875
  return tensor_operator_registry.get('diff')(self, n, axis, prepend, append)
2859
2876
 
2860
2877
  def frac(self):
2861
2878
  r"""
2862
2879
  For details, please refer to :func:`mindspore.ops.frac`.
2863
2880
  """
2864
- self._init_check()
2865
2881
  return tensor_operator_registry.get('frac')(self)
2866
2882
 
2867
2883
  def argwhere(self):
2868
2884
  r"""
2869
2885
  For details, please refer to :func:`mindspore.ops.argwhere`.
2870
2886
  """
2871
- self._init_check()
2872
2887
  return tensor_operator_registry.get('argwhere')(self)
2873
2888
 
2874
2889
  def moveaxis(self, source, destination):
2875
2890
  r"""
2876
2891
  For details, please refer to :func:`mindspore.ops.moveaxis`.
2877
2892
  """
2878
- self._init_check()
2879
2893
  return tensor_operator_registry.get('moveaxis')(self, source, destination)
2880
2894
 
2881
2895
  def movedim(self, source, destination):
2882
2896
  r"""
2883
2897
  For details, please refer to :func:`mindspore.ops.movedim`.
2884
2898
  """
2885
- self._init_check()
2886
2899
  return tensor_operator_registry.get('movedim')(self, source, destination)
2887
2900
 
2888
2901
  def digamma(self):
2889
2902
  r"""
2890
2903
  For details, please refer to :func:`mindspore.ops.digamma`.
2891
2904
  """
2892
- self._init_check()
2893
2905
  return tensor_operator_registry.get('digamma')(self)
2894
2906
 
2895
2907
  def lgamma(self):
2896
2908
  r"""
2897
2909
  For details, please refer to :func:`mindspore.ops.lgamma`.
2898
2910
  """
2899
- self._init_check()
2900
2911
  return tensor_operator_registry.get('lgamma')(self)
2901
2912
 
2902
2913
  def diagonal(self, offset=0, axis1=0, axis2=1):
2903
2914
  """
2904
2915
  For details, please refer to :func:`mindspore.ops.diagonal`.
2905
2916
  """
2906
- self._init_check()
2907
2917
  return tensor_operator_registry.get('diagonal')(self, offset, axis1, axis2)
2908
2918
 
2909
2919
  def diagonal_scatter(self, src, offset=0, dim1=0, dim2=1):
2910
2920
  r"""
2911
2921
  For details, please refer to :func:`mindspore.ops.diagonal_scatter`.
2912
2922
  """
2913
- self._init_check()
2914
2923
  return tensor_operator_registry.get('diagonal_scatter')(self, src, offset, dim1, dim2)
2915
2924
 
2916
2925
  def trace(self, offset=0, axis1=0, axis2=1, dtype=None):
@@ -2935,12 +2944,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2935
2944
  Raises:
2936
2945
  ValueError: If the input tensor has less than two dimensions.
2937
2946
 
2947
+ See also:
2948
+ - :func:`mindspore.Tensor.diagonal`: Return specified diagonals.
2949
+
2938
2950
  Supported Platforms:
2939
2951
  ``Ascend`` ``GPU`` ``CPU``
2940
2952
 
2941
- See also:
2942
- :func:`mindspore.Tensor.diagonal`: Return specified diagonals.
2943
-
2944
2953
  Examples:
2945
2954
  >>> import numpy as np
2946
2955
  >>> from mindspore import Tensor
@@ -2949,7 +2958,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
2949
2958
  3.0
2950
2959
  """
2951
2960
  if offset == 0 and axis1 == 0 and axis2 == 1 and dtype is None:
2952
- self._init_check()
2953
2961
  return tensor_operator_registry.get('trace')(self)
2954
2962
  d = self.diagonal(offset, axis1=axis1, axis2=axis2)
2955
2963
  shape = d.shape
@@ -3022,7 +3030,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3022
3030
  shape_indices = tuple(size_indices if i == axis else 1 for i in range(ndim))
3023
3031
  indices = indices.reshape(shape_indices)
3024
3032
  shape_indices = shape_ni + (indices.size,) + shape_nk
3025
- indices = tensor_operator_registry.get('broadcast_to')(shape_indices)(indices)
3033
+ indices = tensor_operator_registry.get('broadcast_to')(indices, shape_indices)
3026
3034
 
3027
3035
  res = tensor_operator_registry.get('gather_d')(a, axis, indices)
3028
3036
  return res.reshape(shape_out)
@@ -3067,7 +3075,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3067
3075
  """
3068
3076
  if isinstance(choices, Tensor):
3069
3077
  shape_choice = validator.infer_out_shape(self.shape, choices.shape[1:])
3070
- choices = tensor_operator_registry.get('broadcast_to')((choices.shape[0],) + shape_choice)(choices)
3078
+ choices = tensor_operator_registry.get('broadcast_to')(choices, (choices.shape[0],) + shape_choice)
3071
3079
  else:
3072
3080
  # broadcasts choices to the same shape if choices is a sequence
3073
3081
  choicelist = []
@@ -3080,14 +3088,14 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3080
3088
  shape_choice = validator.infer_out_shape(self.shape, *shapes)
3081
3089
  tmp = []
3082
3090
  for choice in choicelist:
3083
- tmp.append(tensor_operator_registry.get('broadcast_to')(shape_choice)(choice))
3091
+ tmp.append(tensor_operator_registry.get('broadcast_to')(choice, shape_choice))
3084
3092
  choices = tensor_operator_registry.get('stack')(tmp, 0)
3085
3093
 
3086
3094
  if self.ndim == 0 or choices.ndim == 0:
3087
3095
  raise ValueError(f"For 'Tensor.choose', the original tensor and the argument 'choices' cannot be scalars."
3088
3096
  f" Their dimensions should all be > 0, but got the original tensor's dimension "
3089
3097
  f"{self.ndim}, 'choices' dimension {choices.ndim}.")
3090
- a = tensor_operator_registry.get('broadcast_to')(shape_choice)(self)
3098
+ a = tensor_operator_registry.get('broadcast_to')(self, shape_choice)
3091
3099
  dtype = choices.dtype
3092
3100
  # adjusts dtype for F.tensor_mul and F.gather_nd
3093
3101
  a = a.astype(mstype.int32)
@@ -3099,10 +3107,10 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3099
3107
  for i in range(ndim):
3100
3108
  dim_grid = Tensor(list(range(a.shape[i])), mstype.int32)
3101
3109
  dim_shape = validator.expanded_shape(ndim, a.shape[i], i)
3102
- dim_grid = tensor_operator_registry.get('broadcast_to')(a.shape)(dim_grid.reshape(dim_shape))
3110
+ dim_grid = tensor_operator_registry.get('broadcast_to')(dim_grid.reshape(dim_shape), a.shape)
3103
3111
  grids.append(dim_grid)
3104
3112
  grid = tensor_operator_registry.get('stack')(grids, -1)
3105
- indices = tensor_operator_registry.get('concatenate')(-1)((a.reshape(a.shape + (1,)), grid))
3113
+ indices = tensor_operator_registry.get('concatenate')((a.reshape(a.shape + (1,)), grid), -1)
3106
3114
  return tensor_operator_registry.get('gather_nd')(choices, indices).astype(dtype)
3107
3115
 
3108
3116
  def searchsorted(self, v, side='left', sorter=None):
@@ -3168,7 +3176,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3168
3176
  r"""
3169
3177
  For details, please refer to :func:`mindspore.ops.gather_nd`.
3170
3178
  """
3171
- self._init_check()
3172
3179
  validator.check_value_type('indices', indices, (Tensor, Tensor_,), 'Tensor.gather_nd')
3173
3180
  return tensor_operator_registry.get('gather_nd')(self, indices)
3174
3181
 
@@ -3176,7 +3183,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3176
3183
  r"""
3177
3184
  For details, please refer to :func:`mindspore.ops.gather`.
3178
3185
  """
3179
- self._init_check()
3180
3186
  validator.check_is_int(axis, 'axis')
3181
3187
  validator.check_is_int(batch_dims, "batch_dims")
3182
3188
  return tensor_operator_registry.get('gather')(self, input_indices, axis, batch_dims)
@@ -3204,13 +3210,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3204
3210
  Returns:
3205
3211
  Variance tensor.
3206
3212
 
3207
- Supported Platforms:
3208
- ``Ascend`` ``GPU`` ``CPU``
3209
-
3210
3213
  See also:
3211
- :func:`mindspore.Tensor.mean`: Reduce a dimension of a tensor by averaging all elements in the dimension.
3214
+ - :func:`mindspore.Tensor.mean`: Reduce a dimension of a tensor by averaging all elements in the dimension.
3215
+ - :func:`mindspore.Tensor.std`: Compute the standard deviation along the specified axis.
3212
3216
 
3213
- :func:`mindspore.Tensor.std`: Compute the standard deviation along the specified axis.
3217
+ Supported Platforms:
3218
+ ``Ascend`` ``GPU`` ``CPU``
3214
3219
 
3215
3220
  Examples:
3216
3221
  >>> import numpy as np
@@ -3257,40 +3262,40 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3257
3262
  Return sum of tensor elements over a given axis.
3258
3263
 
3259
3264
  Note:
3260
- Numpy arguments `out`, `where`, `casting`, `order`, `subok`, `signature`, and
3261
- `extobj` are not supported.
3265
+ Numpy arguments `out`, `where`, `casting`, `order`, `subok`, `signature`, and `extobj` are not supported.
3266
+ The `axis` with tensor type is only used for compatibility with older versions and is not recommended.
3262
3267
 
3263
3268
  Args:
3264
- axis (Union[None, int, tuple(int), list(int)]): Axis or axes along which a sum is performed.
3269
+ axis (Union[None, int, tuple(int), list(int), Tensor]): Axis or axes along which a sum is performed.
3265
3270
  Default: ``None`` .
3266
- If None, sum all the elements of the input tensor.
3267
- If the axis is negative, it counts from the last to the first axis.
3268
- If the axis is a tuple or list of ints, a sum is performed on all the axes specified in the tuple
3269
- or list instead of a single axis or all the axes as before.
3271
+ If ``None`` , sum all the elements of the input tensor.
3272
+ If the `axis` is negative, it counts from the last to the first `axis`.
3273
+ If the `axis` is a tuple or list of ints, a sum is performed on all the axes specified in the tuple
3274
+ or list instead of a single `axis` or all the axes as before.
3270
3275
  dtype (:class:`mindspore.dtype`, optional): defaults to ``None`` . Overrides the dtype of the
3271
3276
  output Tensor.
3272
3277
  keepdims (bool): If this is set to ``True`` , the axes which are reduced are left in the result as
3273
3278
  dimensions with size one. With this option, the result will broadcast correctly against the input
3274
- array. If the default value is passed, then keepdims will not be passed through to the sum method
3279
+ array. If the default value is passed, then `keepdims` will not be passed through to the sum method
3275
3280
  of sub-classes of ndarray, however any non-default value will be. If the sub-class method does not
3276
- implement keepdims any exceptions will be raised. Default: ``False`` .
3281
+ implement `keepdims` any exceptions will be raised. Default: ``False`` .
3277
3282
  initial (scalar): Starting value for the sum. Default: ``None`` .
3278
3283
 
3279
3284
  Returns:
3280
- Tensor. A tensor with the same shape as input, with the specified axis removed.
3281
- If the input tensor is a 0-d array, or if the axis is ``None`` , a scalar is returned.
3285
+ Tensor. A tensor with the same shape as input, with the specified `axis` removed.
3286
+ If the input tensor is a 0-d array, or if the `axis` is ``None`` , a scalar is returned.
3282
3287
 
3283
3288
  Raises:
3284
- TypeError: If input is not array_like, or `axis` is not int, tuple of ints or list of ints,
3289
+ TypeError: If input is not array_like, or `axis` is not int, tuple of ints, list of ints or Tensor,
3285
3290
  or `keepdims` is not integer, or `initial` is not scalar.
3286
- ValueError: If any axis is out of range or duplicate axes exist.
3291
+ ValueError: If any `axis` is out of range or duplicate axes exist.
3292
+
3293
+ See also:
3294
+ - :func:`mindspore.Tensor.cumsum`: Return the cumulative sum of the elements along a given `axis`.
3287
3295
 
3288
3296
  Supported Platforms:
3289
3297
  ``Ascend`` ``GPU`` ``CPU``
3290
3298
 
3291
- See also:
3292
- :func:`mindspore.Tensor.cumsum`: Return the cumulative sum of the elements along a given axis.
3293
-
3294
3299
  Examples:
3295
3300
  >>> import numpy as np
3296
3301
  >>> from mindspore import Tensor
@@ -3335,7 +3340,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3335
3340
  >>> print(output.shape)
3336
3341
  (1, 3, 1, 3)
3337
3342
  """
3338
- self._init_check()
3339
3343
  x = self
3340
3344
  if len(size) == 1 and isinstance(size[0], tuple):
3341
3345
  size = size[0]
@@ -3359,21 +3363,18 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3359
3363
  """
3360
3364
  For details, please refer to :func:`mindspore.ops.nansum`.
3361
3365
  """
3362
- self._init_check()
3363
3366
  return tensor_operator_registry.get('nansum')(self, axis=axis, keepdims=keepdims, dtype=dtype)
3364
3367
 
3365
3368
  def nanmean(self, axis=None, keepdims=False, *, dtype=None):
3366
3369
  r"""
3367
3370
  For details, please refer to :func:`mindspore.ops.nanmean`.
3368
3371
  """
3369
- self._init_check()
3370
3372
  return tensor_operator_registry.get('nanmean')(self, axis, keepdims, dtype=dtype)
3371
3373
 
3372
3374
  def nanmedian(self, axis=-1, keepdims=False):
3373
3375
  r"""
3374
3376
  For details, please refer to :func:`mindspore.ops.nanmedian`.
3375
3377
  """
3376
- self._init_check()
3377
3378
  return tensor_operator_registry.get('nanmedian')(self, axis, keepdims)
3378
3379
 
3379
3380
  def repeat(self, repeats, axis=None):
@@ -3393,13 +3394,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3393
3394
  ValueError: If the axis is out of range.
3394
3395
  TypeError: If arguments have types not specified above.
3395
3396
 
3396
- Supported Platforms:
3397
- ``Ascend`` ``GPU`` ``CPU``
3398
-
3399
3397
  See also:
3400
- :func:`mindspore.Tensor.reshape`: Give a new shape to a tensor without changing its data.
3398
+ - :func:`mindspore.Tensor.reshape`: Give a new shape to a tensor without changing its data.
3399
+ - :func:`mindspore.Tensor.resize`: Changes shape and size of tensor in-place.
3401
3400
 
3402
- :func:`mindspore.Tensor.resize`: Changes shape and size of tensor in-place.
3401
+ Supported Platforms:
3402
+ ``Ascend`` ``GPU`` ``CPU``
3403
3403
 
3404
3404
  Examples:
3405
3405
  >>> import numpy as np
@@ -3448,27 +3448,24 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3448
3448
  for sub, rep in zip(subs, repeats):
3449
3449
  if rep != 0:
3450
3450
  repeated_subs.append(tensor_operator_registry.get('repeat_elements')(sub, rep, axis))
3451
- return tensor_operator_registry.get('concatenate')(axis)(repeated_subs)
3451
+ return tensor_operator_registry.get('concatenate')(repeated_subs, axis)
3452
3452
 
3453
3453
  def repeat_interleave(self, repeats, dim=None):
3454
3454
  """
3455
3455
  For details, please refer to :func:`mindspore.ops.repeat_interleave`.
3456
3456
  """
3457
- self._init_check()
3458
3457
  return tensor_operator_registry.get('repeat_interleave')(self, repeats, dim)
3459
3458
 
3460
3459
  def bernoulli(self, p=0.5, seed=None):
3461
3460
  r"""
3462
3461
  For details, please refer to :func:`mindspore.ops.bernoulli`.
3463
3462
  """
3464
- self._init_check()
3465
3463
  return tensor_operator_registry.get('bernoulli')(self, p, seed)
3466
3464
 
3467
3465
  def random_categorical(self, num_sample, seed=0, dtype=mstype.int64):
3468
3466
  r"""
3469
3467
  For details, please refer to :func:`mindspore.ops.random_categorical`.
3470
3468
  """
3471
- self._init_check()
3472
3469
  validator.check_is_int(num_sample, 'num_sample')
3473
3470
  validator.check_is_int(seed, 'seed')
3474
3471
  return tensor_operator_registry.get('random_categorical')(self, num_sample, seed, dtype)
@@ -3477,14 +3474,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3477
3474
  """
3478
3475
  For details, please refer to :func:`mindspore.ops.masked_select`.
3479
3476
  """
3480
- self._init_check()
3481
3477
  return tensor_operator_registry.get('masked_select')(self, mask)
3482
3478
 
3483
3479
  def gather_elements(self, dim, index):
3484
3480
  """
3485
3481
  For details, please refer to :func:`mindspore.ops.gather_elements`.
3486
3482
  """
3487
- self._init_check()
3488
3483
  validator.check_value_type('index', index, (Tensor, Tensor_,), 'Tensor.gather_elements')
3489
3484
  return tensor_operator_registry.get('gather_elements')(self, dim, index)
3490
3485
 
@@ -3492,7 +3487,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3492
3487
  """
3493
3488
  For details, please refer to :func:`mindspore.ops.nonzero`.
3494
3489
  """
3495
- self._init_check()
3496
3490
  return tensor_operator_registry.get('nonzero')(self)
3497
3491
 
3498
3492
  def svd(self, full_matrices=False, compute_uv=True):
@@ -3510,42 +3504,36 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3510
3504
  r"""
3511
3505
  For details, please refer to :func:`mindspore.ops.hardshrink`.
3512
3506
  """
3513
- self._init_check()
3514
- return tensor_operator_registry.get('hardshrink')(lambd)(self)
3507
+ return tensor_operator_registry.get('hardshrink')(self, lambd)
3515
3508
 
3516
3509
  def heaviside(self, values):
3517
3510
  r"""
3518
3511
  For details, please refer to :func:`mindspore.ops.heaviside`.
3519
3512
  """
3520
- self._init_check()
3521
3513
  return tensor_operator_registry.get('heaviside')(self, values)
3522
3514
 
3523
3515
  def hypot(self, other):
3524
3516
  r"""
3525
3517
  For details, please refer to :func:`mindspore.ops.hypot`.
3526
3518
  """
3527
- self._init_check()
3528
3519
  return tensor_operator_registry.get('hypot')(self, other)
3529
3520
 
3530
3521
  def soft_shrink(self, lambd=0.5):
3531
3522
  r"""
3532
3523
  For details, please refer to :func:`mindspore.ops.soft_shrink`.
3533
3524
  """
3534
- self._init_check()
3535
3525
  return tensor_operator_registry.get('soft_shrink')(self, lambd)
3536
3526
 
3537
3527
  def matrix_determinant(self):
3538
3528
  r"""
3539
3529
  For details, please refer to :func:`mindspore.ops.matrix_determinant`.
3540
3530
  """
3541
- self._init_check()
3542
3531
  return tensor_operator_registry.get('matrix_determinant')(self)
3543
3532
 
3544
3533
  def log_matrix_determinant(self):
3545
3534
  r"""
3546
3535
  For details, please refer to :func:`mindspore.ops.log_matrix_determinant`.
3547
3536
  """
3548
- self._init_check()
3549
3537
  return tensor_operator_registry.get('log_matrix_determinant')(self)
3550
3538
 
3551
3539
  def to_coo(self):
@@ -3579,7 +3567,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3579
3567
  [1 0]] [ 1. -5.] (2, 2)
3580
3568
 
3581
3569
  """
3582
- self._init_check()
3583
3570
  return tensor_operator_registry.get('dense_to_sparse_coo')(self)
3584
3571
 
3585
3572
  def to_csr(self):
@@ -3612,7 +3599,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3612
3599
  >>> print(output.indptr, output.indices, output.values, output.shape)
3613
3600
  [0 1 2] [0 0] [ 1. -5.] (2, 2)
3614
3601
  """
3615
- self._init_check()
3616
3602
  return tensor_operator_registry.get('dense_to_sparse_csr')(self)
3617
3603
 
3618
3604
  def tolist(self):
@@ -3635,42 +3621,36 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3635
3621
  >>> print(out2)
3636
3622
  1
3637
3623
  """
3638
- self._init_check()
3639
3624
  return self.asnumpy().tolist()
3640
3625
 
3641
3626
  def unbind(self, dim=0):
3642
3627
  r"""
3643
3628
  For details, please refer to :func:`mindspore.ops.unbind`.
3644
3629
  """
3645
- self._init_check()
3646
- return tensor_operator_registry.get('unbind')(dim)(self)
3630
+ return tensor_operator_registry.get('unbind')(self, dim)
3647
3631
 
3648
3632
  def unsorted_segment_min(self, segment_ids, num_segments):
3649
3633
  r"""
3650
3634
  For details, please refer to :func:`mindspore.ops.unsorted_segment_min`.
3651
3635
  """
3652
- self._init_check()
3653
3636
  return tensor_operator_registry.get('unsorted_segment_min')(self, segment_ids, num_segments)
3654
3637
 
3655
3638
  def unsorted_segment_max(self, segment_ids, num_segments):
3656
3639
  r"""
3657
3640
  For details, please refer to :func:`mindspore.ops.unsorted_segment_max`.
3658
3641
  """
3659
- self._init_check()
3660
3642
  return tensor_operator_registry.get('unsorted_segment_max')(self, segment_ids, num_segments)
3661
3643
 
3662
3644
  def unsorted_segment_prod(self, segment_ids, num_segments):
3663
3645
  r"""
3664
3646
  For details, please refer to :func:`mindspore.ops.unsorted_segment_prod`.
3665
3647
  """
3666
- self._init_check()
3667
3648
  return tensor_operator_registry.get('unsorted_segment_prod')(self, segment_ids, num_segments)
3668
3649
 
3669
3650
  def unique_consecutive(self, return_idx=False, return_counts=False, axis=None):
3670
3651
  """
3671
3652
  For details, please refer to :func:`mindspore.ops.unique_consecutive`.
3672
3653
  """
3673
- self._init_check()
3674
3654
  output, idx, counts = tensor_operator_registry.get("unique_consecutive")(return_idx, return_counts, axis)(self)
3675
3655
  if return_idx and return_counts:
3676
3656
  return output, idx, counts
@@ -3684,29 +3664,25 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3684
3664
  """
3685
3665
  For details, please refer to :func:`mindspore.ops.unique_with_pad`.
3686
3666
  """
3687
- self._init_check()
3688
- return tensor_operator_registry.get("unique_with_pad")()(self, pad_num)
3667
+ return tensor_operator_registry.get("unique_with_pad")(self, pad_num)
3689
3668
 
3690
3669
  def diag(self):
3691
3670
  r"""
3692
3671
  For details, please refer to :func:`mindspore.ops.diag`.
3693
3672
  """
3694
- self._init_check()
3695
- return tensor_operator_registry.get('diag')()(self)
3673
+ return tensor_operator_registry.get('diag')(self)
3696
3674
 
3697
3675
  def diagflat(self, offset=0):
3698
3676
  r"""
3699
3677
  For details, please refer to :func:`mindspore.ops.diagflat`.
3700
3678
  """
3701
- self._init_check()
3702
3679
  return tensor_operator_registry.get('diagflat')(self, offset)
3703
3680
 
3704
3681
  def xdivy(self, y):
3705
3682
  r"""
3706
3683
  For details, please refer to :func:`mindspore.ops.xdivy`.
3707
3684
  """
3708
- self._init_check()
3709
- return tensor_operator_registry.get("xdivy")()(self, y)
3685
+ return tensor_operator_registry.get("xdivy")(self, y)
3710
3686
 
3711
3687
  def split(self, split_size_or_sections, axis=0):
3712
3688
  """
@@ -3718,7 +3694,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3718
3694
  """
3719
3695
  For details, please refer to :func:`mindspore.ops.tensor_split`.
3720
3696
  """
3721
- self._init_check()
3722
3697
  return tensor_operator_registry.get('tensor_split')(self, indices_or_sections, axis)
3723
3698
 
3724
3699
  def vsplit(self, indices_or_sections):
@@ -3726,28 +3701,25 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3726
3701
  For details, please refer to :func:`mindspore.ops.vsplit`.
3727
3702
  """
3728
3703
 
3729
- self._init_check()
3730
3704
  return tensor_operator_registry.get('vsplit')(self, indices_or_sections)
3731
3705
 
3732
3706
  def hsplit(self, indices_or_sections):
3733
3707
  """
3734
3708
  For details, please refer to :func:`mindspore.ops.hsplit`.
3735
3709
  """
3736
- self._init_check()
3737
3710
  return tensor_operator_registry.get('hsplit')(self, indices_or_sections)
3738
3711
 
3739
3712
  def dsplit(self, indices_or_sections):
3740
3713
  """
3741
3714
  For details, please refer to :func:`mindspore.ops.dsplit`.
3742
3715
  """
3743
- self._init_check()
3744
3716
  return tensor_operator_registry.get('dsplit')(self, indices_or_sections)
3745
3717
 
3746
3718
  def xlogy(self, y):
3747
3719
  r"""
3748
3720
  For details, please refer to :func:`mindspore.ops.xlogy`.
3749
3721
  """
3750
- return tensor_operator_registry.get("xlogy")()(self, y)
3722
+ return tensor_operator_registry.get("xlogy")(self, y)
3751
3723
 
3752
3724
  def eigvals(self):
3753
3725
  r"""
@@ -3762,13 +3734,13 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3762
3734
  r"""
3763
3735
  For details, please refer to :func:`mindspore.ops.erf`.
3764
3736
  """
3765
- return tensor_operator_registry.get("erf")()(self)
3737
+ return tensor_operator_registry.get("erf")(self)
3766
3738
 
3767
3739
  def erfc(self):
3768
3740
  r"""
3769
3741
  For details, please refer to :func:`mindspore.ops.erfc`.
3770
3742
  """
3771
- return tensor_operator_registry.get("erfc")()(self)
3743
+ return tensor_operator_registry.get("erfc")(self)
3772
3744
 
3773
3745
  def tile(self, reps):
3774
3746
  r"""
@@ -3780,29 +3752,26 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3780
3752
  r"""
3781
3753
  For details, please refer to :func:`mindspore.ops.topk`.
3782
3754
  """
3783
- self._init_check()
3784
3755
  return tensor_operator_registry.get("topk")(self, k, dim, largest, sorted)
3785
3756
 
3786
3757
  def top_k(self, k, sorted=True):
3787
3758
  r"""
3788
3759
  `Tensor.top_k` is deprecated, please use `Tensor.topk` instead.
3789
3760
  """
3790
- self._init_check()
3791
3761
  validator.check_is_int(k, 'k')
3792
3762
  validator.check_bool(sorted, 'sorted')
3793
- return tensor_operator_registry.get("top_k")(sorted)(self, k)
3763
+ return tensor_operator_registry.get("top_k")(self, k, sorted)
3794
3764
 
3795
3765
  def sigmoid(self):
3796
3766
  r"""
3797
3767
  For details, please refer to :func:`mindspore.ops.sigmoid`.
3798
3768
  """
3799
- return tensor_operator_registry.get("sigmoid")()(self)
3769
+ return tensor_operator_registry.get("sigmoid")(self)
3800
3770
 
3801
3771
  def median(self, axis=-1, keepdims=False):
3802
3772
  r"""
3803
3773
  For details, please refer to :func:`mindspore.ops.median`.
3804
3774
  """
3805
- self._init_check()
3806
3775
  validator.check_axis_in_range(axis, self.ndim)
3807
3776
  return tensor_operator_registry.get('median')(False, axis, keepdims)(self)
3808
3777
 
@@ -3810,49 +3779,42 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3810
3779
  r"""
3811
3780
  For details, please refer to :func:`mindspore.ops.addmv`.
3812
3781
  """
3813
- self._init_check()
3814
3782
  return tensor_operator_registry.get('addmv')(self, mat, vec, beta=beta, alpha=alpha)
3815
3783
 
3816
3784
  def asinh(self):
3817
3785
  r"""
3818
3786
  For details, please refer to :func:`mindspore.ops.asinh`.
3819
3787
  """
3820
- self._init_check()
3821
3788
  return tensor_operator_registry.get('asinh')(self)
3822
3789
 
3823
3790
  def arcsinh(self):
3824
3791
  r"""
3825
3792
  Alias for :func:`mindspore.Tensor.asinh`.
3826
3793
  """
3827
- self._init_check()
3828
3794
  return tensor_operator_registry.get('arcsinh')(self)
3829
3795
 
3830
3796
  def atan(self):
3831
3797
  r"""
3832
3798
  For details, please refer to :func:`mindspore.ops.atan`.
3833
3799
  """
3834
- self._init_check()
3835
3800
  return tensor_operator_registry.get('atan')(self)
3836
3801
 
3837
3802
  def atanh(self):
3838
3803
  r"""
3839
3804
  For details, please refer to :func:`mindspore.ops.atanh`.
3840
3805
  """
3841
- self._init_check()
3842
3806
  return tensor_operator_registry.get('atanh')(self)
3843
3807
 
3844
3808
  def arctanh(self):
3845
3809
  r"""
3846
3810
  Alias for :func:`mindspore.Tensor.atanh`.
3847
3811
  """
3848
- self._init_check()
3849
3812
  return tensor_operator_registry.get('arctanh')(self)
3850
3813
 
3851
3814
  def bmm(self, mat2):
3852
3815
  r"""
3853
3816
  For details, please refer to :func:`mindspore.ops.bmm`.
3854
3817
  """
3855
- self._init_check()
3856
3818
  return tensor_operator_registry.get('bmm')(self, mat2)
3857
3819
 
3858
3820
  def to(self, dtype):
@@ -3882,8 +3844,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3882
3844
  >>> print(output.dtype)
3883
3845
  Int32
3884
3846
  """
3885
- self._init_check()
3886
- return tensor_operator_registry.get('to')()(self, dtype)
3847
+ return tensor_operator_registry.get('to')(self, dtype)
3887
3848
 
3888
3849
  def type(self, dtype=None):
3889
3850
  r"""
@@ -3909,7 +3870,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3909
3870
  [[1 2]
3910
3871
  [3 4]]
3911
3872
  """
3912
- self._init_check()
3913
3873
  if dtype is None:
3914
3874
  return str(self.dtype)
3915
3875
  return self.astype(dtype)
@@ -3936,7 +3896,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3936
3896
  >>> print(x.dtype)
3937
3897
  Int32
3938
3898
  """
3939
- self._init_check()
3940
3899
  return self.astype(other.dtype)
3941
3900
 
3942
3901
  def bool(self):
@@ -3959,8 +3918,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3959
3918
  >>> print(output.dtype)
3960
3919
  Bool
3961
3920
  """
3962
- self._init_check()
3963
- return tensor_operator_registry.get('bool')()(self, mstype.bool_)
3921
+ return tensor_operator_registry.get('bool')(self, mstype.bool_)
3964
3922
 
3965
3923
  def float(self):
3966
3924
  r"""
@@ -3981,8 +3939,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
3981
3939
  >>> print(output.dtype)
3982
3940
  Float32
3983
3941
  """
3984
- self._init_check()
3985
- return tensor_operator_registry.get('float')()(self, mstype.float32)
3942
+ return tensor_operator_registry.get('float')(self, mstype.float32)
3986
3943
 
3987
3944
  def half(self):
3988
3945
  r"""
@@ -4003,8 +3960,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4003
3960
  >>> print(output.dtype)
4004
3961
  Float16
4005
3962
  """
4006
- self._init_check()
4007
- return tensor_operator_registry.get('half')()(self, mstype.float16)
3963
+ return tensor_operator_registry.get('half')(self, mstype.float16)
4008
3964
 
4009
3965
  def int(self):
4010
3966
  r"""
@@ -4025,8 +3981,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4025
3981
  >>> print(output.dtype)
4026
3982
  Int32
4027
3983
  """
4028
- self._init_check()
4029
- return tensor_operator_registry.get('int')()(self, mstype.int32)
3984
+ return tensor_operator_registry.get('int')(self, mstype.int32)
4030
3985
 
4031
3986
  def long(self):
4032
3987
  r"""
@@ -4047,8 +4002,7 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4047
4002
  >>> print(output.dtype)
4048
4003
  Int64
4049
4004
  """
4050
- self._init_check()
4051
- return tensor_operator_registry.get('long')()(self, mstype.int64)
4005
+ return tensor_operator_registry.get('long')(self, mstype.int64)
4052
4006
 
4053
4007
  def short(self):
4054
4008
  r"""
@@ -4070,22 +4024,19 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4070
4024
  >>> output
4071
4025
  Tensor(shape=[5], dtype=Int16, value= [1, 2, 3, 4, 5])
4072
4026
  """
4073
- self._init_check()
4074
4027
  return tensor_operator_registry.get('cast')(self, mstype.int16)
4075
4028
 
4076
4029
  def cholesky(self, upper=False):
4077
4030
  r"""
4078
4031
  For details, please refer to :func:`mindspore.ops.cholesky`.
4079
4032
  """
4080
- self._init_check()
4081
- return tensor_operator_registry.get('cholesky')(upper=upper)(self)
4033
+ return tensor_operator_registry.get('cholesky')(self, upper=upper)
4082
4034
 
4083
4035
  def cholesky_inverse(self, upper=False):
4084
4036
  r"""
4085
4037
  For details, please refer to :func:`mindspore.ops.cholesky_inverse`.
4086
4038
  """
4087
- self._init_check()
4088
- return tensor_operator_registry.get('cholesky_inverse')(upper=upper)(self)
4039
+ return tensor_operator_registry.get('cholesky_inverse')(self, upper=upper)
4089
4040
 
4090
4041
  def cholesky_solve(self, input2, upper=False):
4091
4042
  r"""
@@ -4094,63 +4045,54 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4094
4045
  .. warning::
4095
4046
  This is an experimental API that is subject to change or deletion.
4096
4047
  """
4097
- self._init_check()
4098
4048
  return tensor_operator_registry.get('cholesky_solve')(self, input2, upper)
4099
4049
 
4100
4050
  def conj(self):
4101
4051
  r"""
4102
4052
  For details, please refer to :func:`mindspore.ops.conj`.
4103
4053
  """
4104
- self._init_check()
4105
4054
  return tensor_operator_registry.get('conj')(self)
4106
4055
 
4107
4056
  def count_nonzero(self, axis=(), keep_dims=False, dtype=mstype.int32):
4108
4057
  r"""
4109
4058
  For details, please refer to :func:`mindspore.ops.count_nonzero`.
4110
4059
  """
4111
- self._init_check()
4112
4060
  return tensor_operator_registry.get('count_nonzero')(self, axis, keep_dims, dtype)
4113
4061
 
4114
4062
  def cross(self, other, dim=None):
4115
4063
  r"""
4116
4064
  For details, please refer to :func:`mindspore.ops.cross`.
4117
4065
  """
4118
- self._init_check()
4119
4066
  return tensor_operator_registry.get('cross')(self, other, dim)
4120
4067
 
4121
4068
  def erfinv(self):
4122
4069
  r"""
4123
4070
  For details, please refer to :func:`mindspore.ops.erfinv`.
4124
4071
  """
4125
- self._init_check()
4126
4072
  return tensor_operator_registry.get('erfinv')(self)
4127
4073
 
4128
4074
  def less_equal(self, other):
4129
4075
  r"""
4130
4076
  For details, please refer to :func:`mindspore.ops.less_equal`.
4131
4077
  """
4132
- self._init_check()
4133
4078
  return tensor_operator_registry.get('less_equal')(self, other)
4134
4079
 
4135
4080
  def lcm(self, other):
4136
4081
  r"""
4137
4082
  For details, please refer to :func:`mindspore.ops.lcm`.
4138
4083
  """
4139
- self._init_check()
4140
4084
  return tensor_operator_registry.get('lcm')(self, other)
4141
4085
 
4142
4086
  def ldexp(self, other):
4143
4087
  r"""
4144
4088
  For details, please refer to :func:`mindspore.ops.ldexp`.
4145
4089
  """
4146
- self._init_check()
4147
4090
  return tensor_operator_registry.get('ldexp')(self, other)
4148
4091
 
4149
4092
  def fold(self, output_size, kernel_size, dilation=1, padding=0, stride=1):
4150
4093
  r"""
4151
4094
  For details, please refer to :func:`mindspore.ops.fold`.
4152
4095
  """
4153
- self._init_check()
4154
4096
  return tensor_operator_registry.get('fold')(self, output_size, kernel_size, dilation, padding, stride)
4155
4097
 
4156
4098
  def unfold(self, kernel_size, dilation=1, padding=0, stride=1):
@@ -4161,70 +4103,62 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4161
4103
  This is an experimental API that is subject to change or deletion.
4162
4104
 
4163
4105
  """
4164
- self._init_check()
4165
4106
  return tensor_operator_registry.get('unfold')(self, kernel_size, dilation, padding, stride)
4166
4107
 
4167
4108
  def expand(self, size):
4168
4109
  r"""
4169
4110
  For details, please refer to :func:`mindspore.ops.broadcast_to`.
4170
4111
  """
4171
- self._init_check()
4112
+ if isinstance(size, Tensor):
4113
+ size = tensor_operator_registry.get('tensortotuple')()(size)
4172
4114
  return tensor_operator_registry.get('expand')(self, size)
4173
4115
 
4174
4116
  def cumprod(self, dim, dtype=None):
4175
4117
  r"""
4176
4118
  For details, please refer to :func:`mindspore.ops.cumprod`.
4177
4119
  """
4178
- self._init_check()
4179
4120
  return tensor_operator_registry.get('cumprod')(self, dim, dtype)
4180
4121
 
4181
4122
  def multiply(self, value):
4182
4123
  r"""
4183
4124
  For details, please refer to :func:`mindspore.ops.multiply`.
4184
4125
  """
4185
- self._init_check()
4186
4126
  return tensor_operator_registry.get('multiply')(self, value)
4187
4127
 
4188
4128
  def div(self, value, *, rounding_mode=None):
4189
4129
  r"""
4190
4130
  For details, please refer to :func:`mindspore.ops.div`.
4191
4131
  """
4192
- self._init_check()
4193
4132
  return tensor_operator_registry.get('div')(self, value, rounding_mode=rounding_mode)
4194
4133
 
4195
4134
  def divide(self, value, *, rounding_mode=None):
4196
4135
  r"""
4197
4136
  Alias for :func:`mindspore.Tensor.div`.
4198
4137
  """
4199
- self._init_check()
4200
4138
  return tensor_operator_registry.get('div')(self, value, rounding_mode=rounding_mode)
4201
4139
 
4202
4140
  def eq(self, other):
4203
4141
  r"""
4204
4142
  For details, please refer to :func:`mindspore.ops.eq`.
4205
4143
  """
4206
- self._init_check()
4207
4144
  return tensor_operator_registry.get('equal')(self, other)
4208
4145
 
4209
4146
  def equal(self, other):
4210
4147
  r"""
4211
4148
  For details, please refer to :func:`mindspore.ops.equal`.
4212
4149
  """
4213
- self._init_check()
4214
4150
  return tensor_operator_registry.get('equal')(self, other)
4215
4151
 
4216
4152
  def expm1(self):
4217
4153
  r"""
4218
4154
  For details, please refer to :func:`mindspore.ops.expm1`.
4219
4155
  """
4220
- self._init_check()
4221
4156
  return tensor_operator_registry.get('expm1')(self)
4222
4157
 
4223
4158
  def index_add(self, dim, index, source, *, alpha=1):
4224
4159
  r"""
4225
4160
  For details, please refer to :func:`mindspore.ops.index_add`.
4226
4161
  """
4227
- self._init_check()
4228
4162
  check_is_number(alpha, (int, float))
4229
4163
  source = tensor_operator_registry.get('__mul__')(source, alpha)
4230
4164
  return tensor_operator_registry.get('index_add')(self, indices=index, y=source, axis=dim)
@@ -4233,42 +4167,36 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4233
4167
  r"""
4234
4168
  For details, please refer to :func:`mindspore.ops.greater`.
4235
4169
  """
4236
- self._init_check()
4237
4170
  return tensor_operator_registry.get('greater')(self, other)
4238
4171
 
4239
4172
  def greater_equal(self, other):
4240
4173
  r"""
4241
4174
  For details, please refer to :func:`mindspore.ops.greater_equal`.
4242
4175
  """
4243
- self._init_check()
4244
4176
  return tensor_operator_registry.get('greater_equal')(self, other)
4245
4177
 
4246
4178
  def igamma(self, other):
4247
4179
  r"""
4248
4180
  For details, please refer to :func:`mindspore.ops.igamma`.
4249
4181
  """
4250
- self._init_check()
4251
4182
  return tensor_operator_registry.get('igamma')(self, other)
4252
4183
 
4253
4184
  def igammac(self, other):
4254
4185
  r"""
4255
4186
  For details, please refer to :func:`mindspore.ops.igammac`.
4256
4187
  """
4257
- self._init_check()
4258
4188
  return tensor_operator_registry.get('igammac')(self, other)
4259
4189
 
4260
4190
  def isinf(self):
4261
4191
  r"""
4262
4192
  For details, please refer to :func:`mindspore.ops.isinf`.
4263
4193
  """
4264
- self._init_check()
4265
4194
  return tensor_operator_registry.get('isinf')(self)
4266
4195
 
4267
4196
  def isnan(self):
4268
4197
  r"""
4269
4198
  For details, please refer to :func:`mindspore.ops.isnan`.
4270
4199
  """
4271
- self._init_check()
4272
4200
  return tensor_operator_registry.get('isnan')(self)
4273
4201
 
4274
4202
  def flip(self, dims):
@@ -4322,14 +4250,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4322
4250
  r"""
4323
4251
  For details, please refer to :func:`mindspore.ops.le`.
4324
4252
  """
4325
- self._init_check()
4326
4253
  return tensor_operator_registry.get('le')(self, other)
4327
4254
 
4328
4255
  def less(self, other):
4329
4256
  r"""
4330
4257
  For details, please refer to :func:`mindspore.ops.less`.
4331
4258
  """
4332
- self._init_check()
4333
4259
  return tensor_operator_registry.get('less')(self, other)
4334
4260
 
4335
4261
  def lt(self, other):
@@ -4342,35 +4268,30 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4342
4268
  r"""
4343
4269
  For details, please refer to :func:`mindspore.ops.logical_and`.
4344
4270
  """
4345
- self._init_check()
4346
4271
  return tensor_operator_registry.get('logical_and')(self, other)
4347
4272
 
4348
4273
  def logical_not(self):
4349
4274
  r"""
4350
4275
  For details, please refer to :func:`mindspore.ops.logical_not`.
4351
4276
  """
4352
- self._init_check()
4353
4277
  return tensor_operator_registry.get('logical_not')(self)
4354
4278
 
4355
4279
  def logical_or(self, other):
4356
4280
  r"""
4357
4281
  For details, please refer to :func:`mindspore.ops.logical_or`.
4358
4282
  """
4359
- self._init_check()
4360
4283
  return tensor_operator_registry.get('logical_or')(self, other)
4361
4284
 
4362
4285
  def logical_xor(self, other):
4363
4286
  r"""
4364
4287
  For details, please refer to :func:`mindspore.ops.logical_xor`.
4365
4288
  """
4366
- self._init_check()
4367
4289
  return tensor_operator_registry.get('logical_xor')(self, other)
4368
4290
 
4369
4291
  def lstsq(self, A):
4370
4292
  r"""
4371
4293
  For details, please refer to :func:`mindspore.ops.lstsq`.
4372
4294
  """
4373
- self._init_check()
4374
4295
  return tensor_operator_registry.get('lstsq')(self, A)
4375
4296
 
4376
4297
  @property
@@ -4394,28 +4315,24 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4394
4315
  r"""
4395
4316
  For details, please refer to :func:`mindspore.ops.mvlgamma`.
4396
4317
  """
4397
- self._init_check()
4398
4318
  return tensor_operator_registry.get('mvlgamma')(self, p)
4399
4319
 
4400
4320
  def matmul(self, tensor2):
4401
4321
  r"""
4402
4322
  For details, please refer to :func:`mindspore.ops.matmul`.
4403
4323
  """
4404
- self._init_check()
4405
4324
  return tensor_operator_registry.get('matmul')(self, tensor2)
4406
4325
 
4407
4326
  def inner(self, other):
4408
4327
  r"""
4409
4328
  For details, please refer to :func:`mindspore.ops.inner`.
4410
4329
  """
4411
- self._init_check()
4412
4330
  return tensor_operator_registry.get('inner')(self, other)
4413
4331
 
4414
4332
  def multinomial(self, num_samples, replacement=True, seed=None):
4415
4333
  r"""
4416
4334
  For details, please refer to :func:`mindspore.ops.multinomial`.
4417
4335
  """
4418
- self._init_check()
4419
4336
  return tensor_operator_registry.get('multinomial')(self, num_samples, replacement, seed)
4420
4337
 
4421
4338
  def matrix_power(self, n):
@@ -4426,35 +4343,30 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4426
4343
  This is an experimental API that is subject to change or deletion.
4427
4344
 
4428
4345
  """
4429
- self._init_check()
4430
4346
  return tensor_operator_registry.get('matrix_power')(self, n)
4431
4347
 
4432
4348
  def maximum(self, other):
4433
4349
  r"""
4434
4350
  For details, please refer to :func:`mindspore.ops.maximum`.
4435
4351
  """
4436
- self._init_check()
4437
4352
  return tensor_operator_registry.get('maximum')(self, other)
4438
4353
 
4439
4354
  def mm(self, mat2):
4440
4355
  r"""
4441
4356
  For details, please refer to :func:`mindspore.ops.mm`.
4442
4357
  """
4443
- self._init_check()
4444
4358
  return tensor_operator_registry.get('mm')(self, mat2)
4445
4359
 
4446
4360
  def msort(self):
4447
4361
  r"""
4448
4362
  For details, please refer to :func:`mindspore.ops.msort`.
4449
4363
  """
4450
- self._init_check()
4451
4364
  return tensor_operator_registry.get('msort')(self)
4452
4365
 
4453
4366
  def mul(self, value):
4454
4367
  r"""
4455
4368
  For details, please refer to :func:`mindspore.ops.mul`.
4456
4369
  """
4457
- self._init_check()
4458
4370
  return tensor_operator_registry.get('mul')(self, value)
4459
4371
 
4460
4372
  def nan_to_num(self, nan=0.0, posinf=None, neginf=None):
@@ -4467,21 +4379,18 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4467
4379
  r"""
4468
4380
  For details, please refer to :func:`mindspore.ops.neg`.
4469
4381
  """
4470
- self._init_check()
4471
4382
  return tensor_operator_registry.get('neg')(self)
4472
4383
 
4473
4384
  def ne(self, other):
4474
4385
  r"""
4475
4386
  For details, please refer to :func:`mindspore.ops.ne`.
4476
4387
  """
4477
- self._init_check()
4478
4388
  return tensor_operator_registry.get('ne')(self, other)
4479
4389
 
4480
4390
  def not_equal(self, other):
4481
4391
  r"""
4482
4392
  For details, please refer to :func:`mindspore.ops.not_equal`.
4483
4393
  """
4484
- self._init_check()
4485
4394
  return tensor_operator_registry.get('not_equal')(self, other)
4486
4395
 
4487
4396
  def new_zeros(self, size, *, dtype=None):
@@ -4517,7 +4426,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4517
4426
  validator.check_value_type('size', size, [list, int, tuple], 'Tensor.new_zeros')
4518
4427
  if isinstance(size, list):
4519
4428
  size = tuple(size)
4520
- self._init_check()
4521
4429
  _dtype = self.dtype if dtype is None else dtype
4522
4430
  return tensor_operator_registry.get('zeros')(size, _dtype)
4523
4431
 
@@ -4554,7 +4462,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4554
4462
  validator.check_value_type('size', size, [list, int, tuple], 'Tensor.new_zeros')
4555
4463
  if isinstance(size, list):
4556
4464
  size = tuple(size)
4557
- self._init_check()
4558
4465
  _dtype = self.dtype if dtype is None else dtype
4559
4466
  return tensor_operator_registry.get('ones')(size, _dtype)
4560
4467
 
@@ -4562,98 +4469,84 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4562
4469
  r"""
4563
4470
  For details, please refer to :func:`mindspore.ops.sign`.
4564
4471
  """
4565
- self._init_check()
4566
4472
  return tensor_operator_registry.get('sign')(self)
4567
4473
 
4568
4474
  def signbit(self):
4569
4475
  """
4570
4476
  For details, please refer to :func:`mindspore.ops.signbit`.
4571
4477
  """
4572
- self._init_check()
4573
4478
  return tensor_operator_registry.get('signbit')(self)
4574
4479
 
4575
4480
  def sgn(self):
4576
4481
  """
4577
4482
  For details, please refer to :func:`mindspore.ops.sgn`.
4578
4483
  """
4579
- self._init_check()
4580
4484
  return tensor_operator_registry.get('sgn')(self)
4581
4485
 
4582
4486
  def sin(self):
4583
4487
  r"""
4584
4488
  For details, please refer to :func:`mindspore.ops.sin`.
4585
4489
  """
4586
- self._init_check()
4587
4490
  return tensor_operator_registry.get('sin')(self)
4588
4491
 
4589
4492
  def sinc(self):
4590
4493
  r"""
4591
4494
  For details, please refer to :func:`mindspore.ops.sinc`.
4592
4495
  """
4593
- self._init_check()
4594
4496
  return tensor_operator_registry.get('sinc')(self)
4595
4497
 
4596
4498
  def sinh(self):
4597
4499
  r"""
4598
4500
  For details, please refer to :func:`mindspore.ops.sinh`.
4599
4501
  """
4600
- self._init_check()
4601
4502
  return tensor_operator_registry.get('sinh')(self)
4602
4503
 
4603
4504
  def sort(self, axis=-1, descending=False):
4604
4505
  r"""
4605
4506
  For details, please refer to :func:`mindspore.ops.sort`.
4606
4507
  """
4607
- self._init_check()
4608
4508
  return tensor_operator_registry.get('sort')(self, axis=axis, descending=descending)
4609
4509
 
4610
4510
  def argsort(self, axis=-1, descending=False):
4611
4511
  """
4612
4512
  For details, please refer to :func:`mindspore.ops.argsort`.
4613
4513
  """
4614
- self._init_check()
4615
4514
  return tensor_operator_registry.get('argsort')(self, axis, descending)
4616
4515
 
4617
4516
  def trunc(self):
4618
4517
  r"""
4619
4518
  For details, please refer to :func:`mindspore.ops.trunc`.
4620
4519
  """
4621
- self._init_check()
4622
4520
  return tensor_operator_registry.get('trunc')(self)
4623
4521
 
4624
4522
  def where(self, condition, y):
4625
4523
  r"""
4626
4524
  For details, please refer to :func:`mindspore.ops.where`.
4627
4525
  """
4628
- self._init_check()
4629
4526
  return tensor_operator_registry.get('where')(condition, self, y)
4630
4527
 
4631
4528
  def imag(self):
4632
4529
  r"""
4633
4530
  For details, please refer to :func:`mindspore.ops.imag`.
4634
4531
  """
4635
- self._init_check()
4636
4532
  return tensor_operator_registry.get('imag')(self)
4637
4533
 
4638
4534
  def quantile(self, q, axis=None, keepdims=False):
4639
4535
  r"""
4640
4536
  For details, please refer to :func:`mindspore.ops.quantile`.
4641
4537
  """
4642
- self._init_check()
4643
4538
  return tensor_operator_registry.get('quantile')(self, q, axis, keepdims)
4644
4539
 
4645
4540
  def nanquantile(self, q, axis=None, keepdims=False):
4646
4541
  """
4647
4542
  For details, please refer to :func:`mindspore.ops.nanquantile`.
4648
4543
  """
4649
- self._init_check()
4650
4544
  return tensor_operator_registry.get('nanquantile')(self, q, axis, keepdims)
4651
4545
 
4652
4546
  def orgqr(self, input2):
4653
4547
  r"""
4654
4548
  For details, please refer to :func:`mindspore.ops.orgqr`.
4655
4549
  """
4656
- self._init_check()
4657
4550
  return tensor_operator_registry.get('orgqr')(self, input2)
4658
4551
 
4659
4552
  def lu_solve(self, LU_data, LU_pivots):
@@ -4663,7 +4556,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4663
4556
  .. warning::
4664
4557
  This is an experimental API that is subject to change or deletion.
4665
4558
  """
4666
- self._init_check()
4667
4559
  return tensor_operator_registry.get('lu_solve')(self, LU_data, LU_pivots)
4668
4560
 
4669
4561
 
@@ -4671,14 +4563,12 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4671
4563
  r"""
4672
4564
  For details, please refer to :func:`mindspore.ops.nextafter`.
4673
4565
  """
4674
- self._init_check()
4675
4566
  return tensor_operator_registry.get('nextafter')(self, other)
4676
4567
 
4677
4568
  def qr(self, some=True):
4678
4569
  r"""
4679
4570
  For details, please refer to :func:`mindspore.ops.qr`.
4680
4571
  """
4681
- self._init_check()
4682
4572
  validator.check_value_type('some', some, bool, 'Tensor.qr')
4683
4573
  return tensor_operator_registry.get('qr')(self, 'reduced' if some else 'complete')
4684
4574
 
@@ -4688,7 +4578,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4688
4578
  For details, please refer to :func:`mindspore.ops.ormqr`,
4689
4579
  Args `input2` and `input3` correspond to the args `tau` and `other` of :func:`mindspore.ops.ormqr`.
4690
4580
  """
4691
- self._init_check()
4692
4581
  return tensor_operator_registry.get('ormqr')(self, input2, input3, left, transpose)
4693
4582
 
4694
4583
 
@@ -4730,7 +4619,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4730
4619
  >>> print(output)
4731
4620
  [5. 6. 3. 7.]
4732
4621
  """
4733
- self._init_check()
4734
4622
  return tensor_operator_registry.get('masked_scatter')()(self, mask, x)
4735
4623
 
4736
4624
 
@@ -4782,7 +4670,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4782
4670
  [[1 5 3]
4783
4671
  [4 8 9]]
4784
4672
  """
4785
- self._init_check()
4786
4673
  validator.check_value_type('accumulate', accumulate, bool, 'Tensor.index_put')
4787
4674
  _index_put = tensor_operator_registry.get('index_put')(0 if accumulate is False else 1)
4788
4675
  return _index_put(self, values, indices)
@@ -4801,7 +4688,6 @@ class Tensor(Tensor_, metaclass=_TensorMeta):
4801
4688
  >>> x = ms.Tensor([1, 2, 3], ms.int64)
4802
4689
  >>> x._offload()
4803
4690
  """
4804
- self._init_check()
4805
4691
  return Tensor_._offload(self)
4806
4692
 
4807
4693
 
@@ -4843,9 +4729,9 @@ def _check_tensor_input(input_data=None, dtype=None, shape=None, init=None):
4843
4729
  raise ValueError("init, dtype and shape must have values at the same time.")
4844
4730
 
4845
4731
  if input_data is not None:
4846
- if isinstance(input_data, np.ndarray) and input_data.ndim > 1 and input_data.size == 0:
4732
+ if isinstance(input_data, np.ndarray) and input_data.ndim >= 1 and input_data.size == 0:
4847
4733
  raise ValueError("input_data can not contain zero dimension.")
4848
- if isinstance(input_data, (tuple, list)) and np.array(input_data).ndim > 1 \
4734
+ if isinstance(input_data, (tuple, list)) and np.array(input_data).ndim >= 1 \
4849
4735
  and np.array(input_data).size == 0:
4850
4736
  raise ValueError("input_data can not contain zero dimension.")
4851
4737