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