mindspore 2.3.0__cp310-cp310-win_amd64.whl → 2.4.0__cp310-cp310-win_amd64.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 (308) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
  3. mindspore/Newtonsoft.Json.dll +0 -0
  4. mindspore/__init__.py +3 -1
  5. mindspore/_c_dataengine.cp310-win_amd64.pyd +0 -0
  6. mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
  7. mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
  8. mindspore/_checkparam.py +50 -9
  9. mindspore/_extends/parse/compile_config.py +41 -0
  10. mindspore/_extends/parse/parser.py +9 -7
  11. mindspore/_extends/parse/standard_method.py +52 -14
  12. mindspore/_extends/pijit/pijit_func_white_list.py +350 -24
  13. mindspore/amp.py +24 -10
  14. mindspore/atlprov.dll +0 -0
  15. mindspore/avcodec-59.dll +0 -0
  16. mindspore/avdevice-59.dll +0 -0
  17. mindspore/avfilter-8.dll +0 -0
  18. mindspore/avformat-59.dll +0 -0
  19. mindspore/avutil-57.dll +0 -0
  20. mindspore/c1.dll +0 -0
  21. mindspore/c1xx.dll +0 -0
  22. mindspore/c2.dll +0 -0
  23. mindspore/common/__init__.py +6 -4
  24. mindspore/common/_pijit_context.py +190 -0
  25. mindspore/common/_register_for_tensor.py +2 -1
  26. mindspore/common/_tensor_overload.py +139 -0
  27. mindspore/common/api.py +102 -87
  28. mindspore/common/dump.py +5 -6
  29. mindspore/common/generator.py +1 -7
  30. mindspore/common/hook_handle.py +14 -26
  31. mindspore/common/mindir_util.py +2 -2
  32. mindspore/common/parameter.py +46 -13
  33. mindspore/common/recompute.py +39 -9
  34. mindspore/common/sparse_tensor.py +7 -3
  35. mindspore/common/tensor.py +209 -29
  36. mindspore/communication/__init__.py +1 -1
  37. mindspore/communication/_comm_helper.py +38 -3
  38. mindspore/communication/comm_func.py +310 -55
  39. mindspore/communication/management.py +14 -14
  40. mindspore/context.py +123 -22
  41. mindspore/dataset/__init__.py +1 -1
  42. mindspore/dataset/audio/__init__.py +1 -1
  43. mindspore/dataset/core/config.py +7 -0
  44. mindspore/dataset/core/validator_helpers.py +7 -0
  45. mindspore/dataset/engine/cache_client.py +1 -1
  46. mindspore/dataset/engine/datasets.py +72 -44
  47. mindspore/dataset/engine/datasets_audio.py +7 -7
  48. mindspore/dataset/engine/datasets_standard_format.py +53 -3
  49. mindspore/dataset/engine/datasets_text.py +20 -20
  50. mindspore/dataset/engine/datasets_user_defined.py +174 -104
  51. mindspore/dataset/engine/datasets_vision.py +33 -33
  52. mindspore/dataset/engine/iterators.py +29 -0
  53. mindspore/dataset/engine/obs/util.py +7 -0
  54. mindspore/dataset/engine/queue.py +114 -60
  55. mindspore/dataset/engine/serializer_deserializer.py +2 -2
  56. mindspore/dataset/engine/validators.py +34 -14
  57. mindspore/dataset/text/__init__.py +1 -4
  58. mindspore/dataset/transforms/__init__.py +0 -3
  59. mindspore/dataset/utils/line_reader.py +2 -0
  60. mindspore/dataset/vision/__init__.py +1 -4
  61. mindspore/dataset/vision/utils.py +1 -1
  62. mindspore/dataset/vision/validators.py +2 -1
  63. mindspore/dnnl.dll +0 -0
  64. mindspore/dpcmi.dll +0 -0
  65. mindspore/{nn/extend → experimental/es}/__init__.py +4 -11
  66. mindspore/experimental/es/embedding_service.py +883 -0
  67. mindspore/{nn/layer → experimental/es}/embedding_service_layer.py +218 -30
  68. mindspore/experimental/llm_boost/__init__.py +21 -0
  69. mindspore/{nn/extend/layer → experimental/llm_boost/atb}/__init__.py +4 -8
  70. mindspore/experimental/llm_boost/atb/boost_base.py +211 -0
  71. mindspore/experimental/llm_boost/atb/llama_boost.py +115 -0
  72. mindspore/experimental/llm_boost/atb/qwen_boost.py +101 -0
  73. mindspore/experimental/llm_boost/register.py +129 -0
  74. mindspore/experimental/llm_boost/utils.py +31 -0
  75. mindspore/experimental/optim/adamw.py +85 -0
  76. mindspore/experimental/optim/optimizer.py +3 -0
  77. mindspore/hal/__init__.py +3 -3
  78. mindspore/hal/contiguous_tensors_handle.py +175 -0
  79. mindspore/hal/stream.py +18 -0
  80. mindspore/include/api/model_group.h +13 -1
  81. mindspore/include/api/types.h +10 -10
  82. mindspore/include/dataset/config.h +2 -2
  83. mindspore/include/dataset/constants.h +2 -2
  84. mindspore/include/dataset/execute.h +2 -2
  85. mindspore/include/dataset/vision.h +4 -0
  86. mindspore/jpeg62.dll +0 -0
  87. mindspore/log.py +1 -1
  88. mindspore/mindrecord/filewriter.py +68 -51
  89. mindspore/mindspore_backend.dll +0 -0
  90. mindspore/mindspore_common.dll +0 -0
  91. mindspore/mindspore_core.dll +0 -0
  92. mindspore/mindspore_glog.dll +0 -0
  93. mindspore/mindspore_np_dtype.dll +0 -0
  94. mindspore/mindspore_ops.dll +0 -0
  95. mindspore/mint/__init__.py +495 -46
  96. mindspore/mint/distributed/__init__.py +31 -0
  97. mindspore/mint/distributed/distributed.py +254 -0
  98. mindspore/mint/nn/__init__.py +266 -21
  99. mindspore/mint/nn/functional.py +125 -19
  100. mindspore/mint/nn/layer/__init__.py +39 -0
  101. mindspore/mint/nn/layer/activation.py +133 -0
  102. mindspore/mint/nn/layer/normalization.py +477 -0
  103. mindspore/mint/nn/layer/pooling.py +110 -0
  104. mindspore/mint/optim/adamw.py +28 -7
  105. mindspore/mint/special/__init__.py +63 -0
  106. mindspore/msobj140.dll +0 -0
  107. mindspore/mspdb140.dll +0 -0
  108. mindspore/mspdbcore.dll +0 -0
  109. mindspore/mspdbst.dll +0 -0
  110. mindspore/mspft140.dll +0 -0
  111. mindspore/msvcdis140.dll +0 -0
  112. mindspore/msvcp140_1.dll +0 -0
  113. mindspore/msvcp140_2.dll +0 -0
  114. mindspore/msvcp140_atomic_wait.dll +0 -0
  115. mindspore/msvcp140_codecvt_ids.dll +0 -0
  116. mindspore/multiprocessing/__init__.py +2 -1
  117. mindspore/nn/__init__.py +0 -1
  118. mindspore/nn/cell.py +275 -93
  119. mindspore/nn/layer/activation.py +211 -44
  120. mindspore/nn/layer/basic.py +113 -3
  121. mindspore/nn/layer/embedding.py +120 -2
  122. mindspore/nn/layer/normalization.py +101 -5
  123. mindspore/nn/layer/padding.py +34 -48
  124. mindspore/nn/layer/pooling.py +161 -7
  125. mindspore/nn/layer/transformer.py +3 -3
  126. mindspore/nn/loss/__init__.py +2 -2
  127. mindspore/nn/loss/loss.py +84 -6
  128. mindspore/nn/optim/__init__.py +2 -1
  129. mindspore/nn/optim/adadelta.py +1 -1
  130. mindspore/nn/optim/adam.py +1 -1
  131. mindspore/nn/optim/lamb.py +1 -1
  132. mindspore/nn/optim/tft_wrapper.py +127 -0
  133. mindspore/nn/wrap/cell_wrapper.py +12 -23
  134. mindspore/nn/wrap/grad_reducer.py +5 -5
  135. mindspore/nn/wrap/loss_scale.py +17 -3
  136. mindspore/numpy/__init__.py +1 -1
  137. mindspore/numpy/array_creations.py +65 -68
  138. mindspore/numpy/array_ops.py +64 -60
  139. mindspore/numpy/fft.py +610 -75
  140. mindspore/numpy/logic_ops.py +11 -10
  141. mindspore/numpy/math_ops.py +85 -84
  142. mindspore/numpy/utils_const.py +4 -4
  143. mindspore/opencv_core452.dll +0 -0
  144. mindspore/opencv_imgcodecs452.dll +0 -0
  145. mindspore/opencv_imgproc452.dll +0 -0
  146. mindspore/ops/__init__.py +6 -4
  147. mindspore/ops/_grad_experimental/grad_comm_ops.py +47 -3
  148. mindspore/ops/_grad_experimental/grad_math_ops.py +0 -22
  149. mindspore/ops/_vmap/vmap_array_ops.py +2 -4
  150. mindspore/ops/_vmap/vmap_math_ops.py +17 -1
  151. mindspore/ops/_vmap/vmap_nn_ops.py +43 -2
  152. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +85 -7
  153. mindspore/ops/auto_generate/gen_arg_dtype_cast.py +2 -0
  154. mindspore/ops/auto_generate/gen_extend_func.py +734 -13
  155. mindspore/ops/auto_generate/gen_ops_def.py +2420 -381
  156. mindspore/ops/auto_generate/gen_ops_prim.py +5196 -1659
  157. mindspore/ops/auto_generate/pyboost_inner_prim.py +176 -56
  158. mindspore/ops/composite/base.py +85 -48
  159. mindspore/ops/composite/multitype_ops/_compile_utils.py +1 -0
  160. mindspore/ops/composite/multitype_ops/not_in_impl.py +2 -2
  161. mindspore/ops/function/__init__.py +22 -0
  162. mindspore/ops/function/array_func.py +490 -153
  163. mindspore/ops/function/debug_func.py +113 -1
  164. mindspore/ops/function/fft_func.py +15 -2
  165. mindspore/ops/function/grad/grad_func.py +3 -2
  166. mindspore/ops/function/math_func.py +558 -207
  167. mindspore/ops/function/nn_func.py +817 -383
  168. mindspore/ops/function/other_func.py +3 -2
  169. mindspore/ops/function/random_func.py +184 -8
  170. mindspore/ops/function/reshard_func.py +13 -11
  171. mindspore/ops/function/sparse_unary_func.py +1 -1
  172. mindspore/ops/function/vmap_func.py +3 -2
  173. mindspore/ops/functional.py +24 -14
  174. mindspore/ops/op_info_register.py +3 -3
  175. mindspore/ops/operations/__init__.py +6 -1
  176. mindspore/ops/operations/_grad_ops.py +2 -76
  177. mindspore/ops/operations/_infer_ops.py +1 -1
  178. mindspore/ops/operations/_inner_ops.py +71 -94
  179. mindspore/ops/operations/array_ops.py +12 -146
  180. mindspore/ops/operations/comm_ops.py +42 -53
  181. mindspore/ops/operations/custom_ops.py +83 -19
  182. mindspore/ops/operations/debug_ops.py +42 -10
  183. mindspore/ops/operations/manually_defined/_inner.py +12 -0
  184. mindspore/ops/operations/manually_defined/ops_def.py +265 -10
  185. mindspore/ops/operations/math_ops.py +12 -223
  186. mindspore/ops/operations/nn_ops.py +20 -114
  187. mindspore/ops/operations/other_ops.py +7 -4
  188. mindspore/ops/operations/random_ops.py +46 -1
  189. mindspore/ops/primitive.py +18 -6
  190. mindspore/ops_generate/arg_dtype_cast.py +2 -0
  191. mindspore/ops_generate/gen_aclnn_implement.py +11 -11
  192. mindspore/ops_generate/gen_constants.py +36 -0
  193. mindspore/ops_generate/gen_ops.py +67 -52
  194. mindspore/ops_generate/gen_ops_inner_prim.py +1 -1
  195. mindspore/ops_generate/gen_pyboost_func.py +131 -47
  196. mindspore/ops_generate/op_proto.py +10 -3
  197. mindspore/ops_generate/pyboost_utils.py +14 -1
  198. mindspore/ops_generate/template.py +43 -21
  199. mindspore/parallel/__init__.py +3 -1
  200. mindspore/parallel/_auto_parallel_context.py +28 -8
  201. mindspore/parallel/_cell_wrapper.py +83 -0
  202. mindspore/parallel/_parallel_serialization.py +47 -19
  203. mindspore/parallel/_tensor.py +81 -11
  204. mindspore/parallel/_utils.py +13 -1
  205. mindspore/parallel/algo_parameter_config.py +5 -5
  206. mindspore/parallel/checkpoint_transform.py +46 -39
  207. mindspore/parallel/cluster/process_entity/__init__.py +1 -1
  208. mindspore/parallel/cluster/process_entity/_api.py +31 -23
  209. mindspore/parallel/cluster/process_entity/_utils.py +2 -27
  210. mindspore/parallel/parameter_broadcast.py +3 -4
  211. mindspore/parallel/shard.py +162 -31
  212. mindspore/parallel/transform_safetensors.py +993 -0
  213. mindspore/pgodb140.dll +0 -0
  214. mindspore/pgort140.dll +0 -0
  215. mindspore/profiler/__init__.py +2 -1
  216. mindspore/profiler/common/constant.py +29 -0
  217. mindspore/profiler/common/registry.py +47 -0
  218. mindspore/profiler/common/util.py +28 -0
  219. mindspore/profiler/dynamic_profiler.py +694 -0
  220. mindspore/profiler/envprofiling.py +17 -19
  221. mindspore/profiler/parser/ascend_analysis/constant.py +18 -0
  222. mindspore/profiler/parser/ascend_analysis/file_manager.py +25 -4
  223. mindspore/profiler/parser/ascend_analysis/function_event.py +43 -19
  224. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +31 -26
  225. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +56 -10
  226. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +55 -8
  227. mindspore/profiler/parser/ascend_analysis/path_manager.py +313 -0
  228. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +27 -20
  229. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +9 -2
  230. mindspore/profiler/parser/ascend_msprof_exporter.py +5 -4
  231. mindspore/profiler/parser/ascend_timeline_generator.py +27 -25
  232. mindspore/profiler/parser/base_timeline_generator.py +19 -25
  233. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +25 -12
  234. mindspore/profiler/parser/framework_parser.py +1 -391
  235. mindspore/profiler/parser/gpu_analysis/__init__.py +14 -0
  236. mindspore/profiler/parser/gpu_analysis/function_event.py +44 -0
  237. mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +89 -0
  238. mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +72 -0
  239. mindspore/profiler/parser/memory_usage_parser.py +0 -154
  240. mindspore/profiler/parser/profiler_info.py +78 -6
  241. mindspore/profiler/profiler.py +153 -0
  242. mindspore/profiler/profiling.py +280 -412
  243. mindspore/rewrite/__init__.py +1 -2
  244. mindspore/rewrite/common/namespace.py +4 -4
  245. mindspore/rewrite/symbol_tree/symbol_tree.py +3 -3
  246. mindspore/run_check/_check_version.py +36 -103
  247. mindspore/safeguard/rewrite_obfuscation.py +591 -247
  248. mindspore/swresample-4.dll +0 -0
  249. mindspore/swscale-6.dll +0 -0
  250. mindspore/tbbmalloc.dll +0 -0
  251. mindspore/tinyxml2.dll +0 -0
  252. mindspore/train/__init__.py +4 -3
  253. mindspore/train/_utils.py +28 -2
  254. mindspore/train/amp.py +171 -53
  255. mindspore/train/callback/__init__.py +2 -2
  256. mindspore/train/callback/_callback.py +4 -4
  257. mindspore/train/callback/_checkpoint.py +85 -22
  258. mindspore/train/callback/_cluster_monitor.py +1 -1
  259. mindspore/train/callback/_flops_collector.py +1 -0
  260. mindspore/train/callback/_loss_monitor.py +3 -3
  261. mindspore/train/callback/_on_request_exit.py +134 -31
  262. mindspore/train/callback/_summary_collector.py +5 -5
  263. mindspore/train/callback/_tft_register.py +352 -0
  264. mindspore/train/dataset_helper.py +7 -3
  265. mindspore/train/metrics/metric.py +3 -3
  266. mindspore/train/metrics/roc.py +4 -4
  267. mindspore/train/mind_ir_pb2.py +44 -39
  268. mindspore/train/model.py +134 -58
  269. mindspore/train/serialization.py +336 -112
  270. mindspore/turbojpeg.dll +0 -0
  271. mindspore/utils/__init__.py +21 -0
  272. mindspore/utils/utils.py +60 -0
  273. mindspore/vcmeta.dll +0 -0
  274. mindspore/vcruntime140.dll +0 -0
  275. mindspore/vcruntime140_1.dll +0 -0
  276. mindspore/version.py +1 -1
  277. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/METADATA +6 -2
  278. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/RECORD +281 -275
  279. mindspore/include/c_api/ms/abstract.h +0 -67
  280. mindspore/include/c_api/ms/attribute.h +0 -197
  281. mindspore/include/c_api/ms/base/handle_types.h +0 -43
  282. mindspore/include/c_api/ms/base/macros.h +0 -32
  283. mindspore/include/c_api/ms/base/status.h +0 -33
  284. mindspore/include/c_api/ms/base/types.h +0 -283
  285. mindspore/include/c_api/ms/context.h +0 -102
  286. mindspore/include/c_api/ms/graph.h +0 -160
  287. mindspore/include/c_api/ms/node.h +0 -606
  288. mindspore/include/c_api/ms/tensor.h +0 -161
  289. mindspore/include/c_api/ms/value.h +0 -84
  290. mindspore/mindspore_shared_lib.dll +0 -0
  291. mindspore/nn/extend/basic.py +0 -140
  292. mindspore/nn/extend/embedding.py +0 -143
  293. mindspore/nn/extend/layer/normalization.py +0 -109
  294. mindspore/nn/extend/pooling.py +0 -117
  295. mindspore/nn/layer/embedding_service.py +0 -531
  296. mindspore/ops/_op_impl/aicpu/strided_slice_v2.py +0 -93
  297. mindspore/ops/_op_impl/aicpu/strided_slice_v2_grad.py +0 -66
  298. mindspore/ops/extend/__init__.py +0 -53
  299. mindspore/ops/extend/array_func.py +0 -218
  300. mindspore/ops/extend/math_func.py +0 -76
  301. mindspore/ops/extend/nn_func.py +0 -308
  302. mindspore/ops/silent_check.py +0 -162
  303. mindspore/profiler/parser/msadvisor_analyzer.py +0 -82
  304. mindspore/profiler/parser/msadvisor_parser.py +0 -240
  305. mindspore/train/callback/_mindio_ttp.py +0 -443
  306. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/WHEEL +0 -0
  307. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/entry_points.txt +0 -0
  308. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/top_level.txt +0 -0
@@ -1,102 +0,0 @@
1
- /**
2
- * Copyright 2022 Huawei Technologies Co., Ltd
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #ifndef MINDSPORE_CCSRC_C_API_INCLUDE_CONTEXT_H_
18
- #define MINDSPORE_CCSRC_C_API_INCLUDE_CONTEXT_H_
19
-
20
- #include <stdint.h>
21
- #include <stdlib.h>
22
- #include "include/c_api/ms/base/macros.h"
23
- #include "include/c_api/ms/base/status.h"
24
- #include "include/c_api/ms/base/handle_types.h"
25
-
26
- #ifdef __cplusplus
27
- extern "C" {
28
- #endif
29
- /// \brief Create a resource manager. Tracking allocated objects(i.e. FuncGraph, Nodes...).
30
- MIND_C_API ResMgrHandle MSResourceManagerCreate();
31
-
32
- /// \brief Release a resource manager and the enclosed objects.
33
- ///
34
- /// \param[in] res_mgr Manager Handle that manages the resource of the funcGraph.
35
- MIND_C_API void MSResourceManagerDestroy(ResMgrHandle res_mgr);
36
-
37
- /// \brief Set context to Graph or pynative mood.
38
- ///
39
- /// \param[in] eager_mode True: Pynative, False: Graph.
40
- MIND_C_API void MSSetEagerMode(bool eager_mode);
41
-
42
- /// \brief Select MindRT, VM or GE as Backend Policy.
43
- ///
44
- /// \param[in] policy select one from {"ge", "vm", "ms", "ge_only", "vm_prior"}.
45
- ///
46
- /// \return Error code indicates whether the function executed successfully.
47
- MIND_C_API STATUS MSSetBackendPolicy(const char *policy);
48
-
49
- /// \brief Get backend policy context.
50
- ///
51
- /// \param[in] str_buf The char array to contain the backend policy string.
52
- /// \param[in] str_len The size of the char array.
53
- ///
54
- /// \return name of the device under current context
55
- MIND_C_API STATUS MSGetBackendPolicy(char str_buf[], size_t str_len);
56
-
57
- /// \brief set device type context.
58
- ///
59
- /// \param[in] device type name of the device i.e. CPU, GPU, Ascend.
60
- MIND_C_API void MSSetDeviceTarget(const char *device);
61
-
62
- /// \brief Get device type context.
63
- ///
64
- /// \param[in] str_buf The char array to contain the device target string.
65
- /// \param[in] str_len The size of the char array.
66
- ///
67
- /// \return name of the device under current context
68
- MIND_C_API STATUS MSGetDeviceTarget(char str_buf[], size_t str_len);
69
-
70
- /// \brief Set Device ID context.
71
- ///
72
- /// \param[in] deviceId Device ID.
73
- MIND_C_API void MSSetDeviceId(uint32_t deviceId);
74
-
75
- /// \brief Set flag for saving the graph.
76
- ///
77
- /// \param[in] save_mode The flag to control the amount of saved graph files. There are 3 levels:
78
- /// 1: Basic level. Only save frontend IR graph and some common backend IR graphs.
79
- /// 2: Advanced level. Save all graphs except for verbose IR graphs and dot files.
80
- /// 3: Full level. Save all IR graphs.
81
- MIND_C_API void MSSetIRGraphsSaveMode(int save_mode);
82
-
83
- /// \brief Set save path of IRGraphs.
84
- ///
85
- /// \param[in] save_path The save path.
86
- MIND_C_API void MSSetIRGraphsSavePath(const char *save_path);
87
-
88
- /// \brief Set flag for auto shape and type infer.
89
- ///
90
- /// \param[in] res_mgr Manager Handle that manages the resource of the funcGraph.
91
- /// \param[in] infer True: Use inner auto infer, False: Not use auto infer.
92
- MIND_C_API void MSSetInfer(ResMgrHandle res_mgr, bool infer);
93
-
94
- /// \brief Get flag for auto shape and type infer.
95
- ///
96
- /// \param[in] res_mgr Manager Handle that manages the resource of the funcGraph.
97
- MIND_C_API bool MSGetInfer(ResMgrHandle res_mgr);
98
-
99
- #ifdef __cplusplus
100
- }
101
- #endif
102
- #endif // MINDSPORE_CCSRC_C_API_INCLUDE_CONTEXT_H_
@@ -1,160 +0,0 @@
1
- /**
2
- * Copyright 2022 Huawei Technologies Co., Ltd
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #ifndef MINDSPORE_CCSRC_C_API_INCLUDE_GRAPH_H_
18
- #define MINDSPORE_CCSRC_C_API_INCLUDE_GRAPH_H_
19
-
20
- #include <stdbool.h>
21
- #include <stdlib.h>
22
- #include "include/c_api/ms/node.h"
23
- #include "include/c_api/ms/base/macros.h"
24
- #include "include/c_api/ms/base/status.h"
25
- #include "include/c_api/ms/context.h"
26
-
27
- #ifdef __cplusplus
28
- extern "C" {
29
- #endif
30
-
31
- /// \brief Creates an empty function graph.
32
- ///
33
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
34
- ///
35
- /// \return The created function graph.
36
- MIND_C_API GraphHandle MSFuncGraphCreate(ResMgrHandle res_mgr);
37
-
38
- /// \brief Load function graph from MINDIR.
39
- ///
40
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
41
- /// \param[in] file_path The path of MINDIR.
42
- ///
43
- /// \return The loaded function graph.
44
- MIND_C_API GraphHandle MSFuncGraphLoad(ResMgrHandle res_mgr, const char *file_path);
45
-
46
- /// \brief Get the input node of the function graph.
47
- ///
48
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
49
- /// \param[in] graph The given function graph pointer handle.
50
- /// \param[in] i Index of the input node.
51
- ///
52
- /// \return The created function graph.
53
- MIND_C_API NodeHandle MSFuncGraphGetInput(ResMgrHandle res_mgr, ConstGraphHandle graph, size_t i);
54
-
55
- /// \brief Get the inputs number of the function graph.
56
- ///
57
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
58
- /// \param[in] graph The given function graph pointer handle.
59
- /// \param[in] error Records error code that indicate whether the functions executed successfully.
60
- ///
61
- /// \return the inputs number of the function graph.
62
- MIND_C_API size_t MSFuncGraphGetInputNum(ResMgrHandle res_mgr, ConstGraphHandle graph, STATUS *error);
63
-
64
- /// \brief Get all inputs of the function graph.
65
- ///
66
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
67
- /// \param[in] graph The given function graph pointer handle.
68
- /// \param[in] inputs The array to contain input nodes.
69
- /// \param[in] input_num The length of the array.
70
- ///
71
- /// \return Error code that indicate whether the functions executed successfully.
72
- MIND_C_API STATUS MSFuncGraphGetInputs(ResMgrHandle res_mgr, ConstGraphHandle graph, NodeHandle inputs[],
73
- size_t input_num);
74
-
75
- /// \brief Set the output node.
76
- ///
77
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
78
- /// \param[in] graph The given function graph pointer handle.
79
- /// \param[in] op_node The output operator node to be set.
80
- /// \param[in] force_new_ret If true, a new return node is always created.
81
- ///
82
- /// \return Error code that indicate whether the functions executed successfully.
83
- MIND_C_API STATUS MSFuncGraphSetOutput(ResMgrHandle res_mgr, GraphHandle graph, ConstNodeHandle op_node,
84
- bool force_new_ret);
85
-
86
- /// \brief Set the output node.
87
- ///
88
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
89
- /// \param[in] graph The given function graph pointer handle.
90
- /// \param[in] outputs The array of output operator nodes.
91
- /// \param[in] force_new_ret If true, a new return node is always created.
92
- ///
93
- /// \return Error code that indicate whether the functions executed successfully.
94
- MIND_C_API STATUS MSFuncGraphSetOutputs(ResMgrHandle res_mgr, GraphHandle graph, Handle const outputs[],
95
- size_t output_num, bool force_new_ret);
96
-
97
- /// \brief Get the output node according to the index.
98
- ///
99
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
100
- /// \param[in] graph The given function graph pointer handle.
101
- /// \param[in] i The index to get the output. If there is only one output for graph, the i should be 0;
102
- ///
103
- /// \return The output node, nullptr if output not set.
104
- MIND_C_API NodeHandle MSFuncGraphGetOutput(ResMgrHandle res_mgr, ConstGraphHandle graph, size_t i);
105
-
106
- /// \brief Get the outputs number of the function graph.
107
- ///
108
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
109
- /// \param[in] graph The given function graph pointer handle.
110
- /// \param[in] error Records error code that indicate whether the functions executed successfully.
111
- ///
112
- /// \return the outputs number of the function graph.
113
- MIND_C_API size_t MSFuncGraphGetOutputNum(ResMgrHandle res_mgr, ConstGraphHandle graph, STATUS *error);
114
-
115
- /// \brief Get all outputs of the function graph.
116
- ///
117
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
118
- /// \param[in] graph The given function graph pointer handle.
119
- /// \param[in] outputs The array to contain input nodes.
120
- /// \param[in] output_num The length of the array.
121
- ///
122
- /// \return Error code that indicate whether the functions executed successfully.
123
- MIND_C_API STATUS MSFuncGraphGetOutputs(ResMgrHandle res_mgr, ConstGraphHandle graph, NodeHandle outputs[],
124
- size_t output_num);
125
-
126
- /// \brief Replace a node in a function graph.
127
- ///
128
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
129
- /// \param[in] graph The given function graph pointer handle.
130
- /// \param[in] new_node The node needs to be replaced.
131
- /// \param[in] new_node The replace node.
132
- ///
133
- /// \return Error code that indicate whether the functions executed successfully.
134
- MIND_C_API STATUS MSFuncGraphReplace(ResMgrHandle res_mgr, GraphHandle graph, ConstNodeHandle old_node,
135
- ConstNodeHandle new_node);
136
-
137
- /// \brief Compile the function graph.
138
- ///
139
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
140
- /// \param[in] graph The given function graph pointer handle.
141
- ///
142
- /// \return Error code that indicate whether the function graph compiled successfully.
143
- MIND_C_API STATUS MSFuncGraphCompile(ResMgrHandle res_mgr, GraphHandle graph, OptPassID *opt_pass, size_t pass_num);
144
-
145
- /// \brief Run the function graph.
146
- ///
147
- /// \param[in] res_mgr Resource manager that saves allocated instance resources.
148
- /// \param[in] graph The given function graph pointer handle.
149
- /// \param[in] inputs The function graph (model) inputs which can be Values or Tensors.
150
- /// \param[in] input_num The input size.
151
- /// \param[in] outputs The function graph (model) outputs in Tensor form.
152
- /// \param[in] outputs_num The output size.
153
- ///
154
- /// \return Error code that indicate whether the function graph executed successfully.
155
- MIND_C_API STATUS MSFuncGraphRun(ResMgrHandle res_mgr, GraphHandle graph, Handle const inputs[], size_t input_num,
156
- TensorHandle outputs[], size_t outputs_num);
157
- #ifdef __cplusplus
158
- }
159
- #endif
160
- #endif // MINDSPORE_CCSRC_C_API_INCLUDE_GRAPH_H_