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.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +3 -1
- mindspore/_c_dataengine.cp310-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +50 -9
- mindspore/_extends/parse/compile_config.py +41 -0
- mindspore/_extends/parse/parser.py +9 -7
- mindspore/_extends/parse/standard_method.py +52 -14
- mindspore/_extends/pijit/pijit_func_white_list.py +350 -24
- mindspore/amp.py +24 -10
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +6 -4
- mindspore/common/_pijit_context.py +190 -0
- mindspore/common/_register_for_tensor.py +2 -1
- mindspore/common/_tensor_overload.py +139 -0
- mindspore/common/api.py +102 -87
- mindspore/common/dump.py +5 -6
- mindspore/common/generator.py +1 -7
- mindspore/common/hook_handle.py +14 -26
- mindspore/common/mindir_util.py +2 -2
- mindspore/common/parameter.py +46 -13
- mindspore/common/recompute.py +39 -9
- mindspore/common/sparse_tensor.py +7 -3
- mindspore/common/tensor.py +209 -29
- mindspore/communication/__init__.py +1 -1
- mindspore/communication/_comm_helper.py +38 -3
- mindspore/communication/comm_func.py +310 -55
- mindspore/communication/management.py +14 -14
- mindspore/context.py +123 -22
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/__init__.py +1 -1
- mindspore/dataset/core/config.py +7 -0
- mindspore/dataset/core/validator_helpers.py +7 -0
- mindspore/dataset/engine/cache_client.py +1 -1
- mindspore/dataset/engine/datasets.py +72 -44
- mindspore/dataset/engine/datasets_audio.py +7 -7
- mindspore/dataset/engine/datasets_standard_format.py +53 -3
- mindspore/dataset/engine/datasets_text.py +20 -20
- mindspore/dataset/engine/datasets_user_defined.py +174 -104
- mindspore/dataset/engine/datasets_vision.py +33 -33
- mindspore/dataset/engine/iterators.py +29 -0
- mindspore/dataset/engine/obs/util.py +7 -0
- mindspore/dataset/engine/queue.py +114 -60
- mindspore/dataset/engine/serializer_deserializer.py +2 -2
- mindspore/dataset/engine/validators.py +34 -14
- mindspore/dataset/text/__init__.py +1 -4
- mindspore/dataset/transforms/__init__.py +0 -3
- mindspore/dataset/utils/line_reader.py +2 -0
- mindspore/dataset/vision/__init__.py +1 -4
- mindspore/dataset/vision/utils.py +1 -1
- mindspore/dataset/vision/validators.py +2 -1
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/{nn/extend → experimental/es}/__init__.py +4 -11
- mindspore/experimental/es/embedding_service.py +883 -0
- mindspore/{nn/layer → experimental/es}/embedding_service_layer.py +218 -30
- mindspore/experimental/llm_boost/__init__.py +21 -0
- mindspore/{nn/extend/layer → experimental/llm_boost/atb}/__init__.py +4 -8
- mindspore/experimental/llm_boost/atb/boost_base.py +211 -0
- mindspore/experimental/llm_boost/atb/llama_boost.py +115 -0
- mindspore/experimental/llm_boost/atb/qwen_boost.py +101 -0
- mindspore/experimental/llm_boost/register.py +129 -0
- mindspore/experimental/llm_boost/utils.py +31 -0
- mindspore/experimental/optim/adamw.py +85 -0
- mindspore/experimental/optim/optimizer.py +3 -0
- mindspore/hal/__init__.py +3 -3
- mindspore/hal/contiguous_tensors_handle.py +175 -0
- mindspore/hal/stream.py +18 -0
- mindspore/include/api/model_group.h +13 -1
- mindspore/include/api/types.h +10 -10
- mindspore/include/dataset/config.h +2 -2
- mindspore/include/dataset/constants.h +2 -2
- mindspore/include/dataset/execute.h +2 -2
- mindspore/include/dataset/vision.h +4 -0
- mindspore/jpeg62.dll +0 -0
- mindspore/log.py +1 -1
- mindspore/mindrecord/filewriter.py +68 -51
- mindspore/mindspore_backend.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_np_dtype.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mint/__init__.py +495 -46
- mindspore/mint/distributed/__init__.py +31 -0
- mindspore/mint/distributed/distributed.py +254 -0
- mindspore/mint/nn/__init__.py +266 -21
- mindspore/mint/nn/functional.py +125 -19
- mindspore/mint/nn/layer/__init__.py +39 -0
- mindspore/mint/nn/layer/activation.py +133 -0
- mindspore/mint/nn/layer/normalization.py +477 -0
- mindspore/mint/nn/layer/pooling.py +110 -0
- mindspore/mint/optim/adamw.py +28 -7
- mindspore/mint/special/__init__.py +63 -0
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/multiprocessing/__init__.py +2 -1
- mindspore/nn/__init__.py +0 -1
- mindspore/nn/cell.py +275 -93
- mindspore/nn/layer/activation.py +211 -44
- mindspore/nn/layer/basic.py +113 -3
- mindspore/nn/layer/embedding.py +120 -2
- mindspore/nn/layer/normalization.py +101 -5
- mindspore/nn/layer/padding.py +34 -48
- mindspore/nn/layer/pooling.py +161 -7
- mindspore/nn/layer/transformer.py +3 -3
- mindspore/nn/loss/__init__.py +2 -2
- mindspore/nn/loss/loss.py +84 -6
- mindspore/nn/optim/__init__.py +2 -1
- mindspore/nn/optim/adadelta.py +1 -1
- mindspore/nn/optim/adam.py +1 -1
- mindspore/nn/optim/lamb.py +1 -1
- mindspore/nn/optim/tft_wrapper.py +127 -0
- mindspore/nn/wrap/cell_wrapper.py +12 -23
- mindspore/nn/wrap/grad_reducer.py +5 -5
- mindspore/nn/wrap/loss_scale.py +17 -3
- mindspore/numpy/__init__.py +1 -1
- mindspore/numpy/array_creations.py +65 -68
- mindspore/numpy/array_ops.py +64 -60
- mindspore/numpy/fft.py +610 -75
- mindspore/numpy/logic_ops.py +11 -10
- mindspore/numpy/math_ops.py +85 -84
- mindspore/numpy/utils_const.py +4 -4
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/__init__.py +6 -4
- mindspore/ops/_grad_experimental/grad_comm_ops.py +47 -3
- mindspore/ops/_grad_experimental/grad_math_ops.py +0 -22
- mindspore/ops/_vmap/vmap_array_ops.py +2 -4
- mindspore/ops/_vmap/vmap_math_ops.py +17 -1
- mindspore/ops/_vmap/vmap_nn_ops.py +43 -2
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +85 -7
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +2 -0
- mindspore/ops/auto_generate/gen_extend_func.py +734 -13
- mindspore/ops/auto_generate/gen_ops_def.py +2420 -381
- mindspore/ops/auto_generate/gen_ops_prim.py +5196 -1659
- mindspore/ops/auto_generate/pyboost_inner_prim.py +176 -56
- mindspore/ops/composite/base.py +85 -48
- mindspore/ops/composite/multitype_ops/_compile_utils.py +1 -0
- mindspore/ops/composite/multitype_ops/not_in_impl.py +2 -2
- mindspore/ops/function/__init__.py +22 -0
- mindspore/ops/function/array_func.py +490 -153
- mindspore/ops/function/debug_func.py +113 -1
- mindspore/ops/function/fft_func.py +15 -2
- mindspore/ops/function/grad/grad_func.py +3 -2
- mindspore/ops/function/math_func.py +558 -207
- mindspore/ops/function/nn_func.py +817 -383
- mindspore/ops/function/other_func.py +3 -2
- mindspore/ops/function/random_func.py +184 -8
- mindspore/ops/function/reshard_func.py +13 -11
- mindspore/ops/function/sparse_unary_func.py +1 -1
- mindspore/ops/function/vmap_func.py +3 -2
- mindspore/ops/functional.py +24 -14
- mindspore/ops/op_info_register.py +3 -3
- mindspore/ops/operations/__init__.py +6 -1
- mindspore/ops/operations/_grad_ops.py +2 -76
- mindspore/ops/operations/_infer_ops.py +1 -1
- mindspore/ops/operations/_inner_ops.py +71 -94
- mindspore/ops/operations/array_ops.py +12 -146
- mindspore/ops/operations/comm_ops.py +42 -53
- mindspore/ops/operations/custom_ops.py +83 -19
- mindspore/ops/operations/debug_ops.py +42 -10
- mindspore/ops/operations/manually_defined/_inner.py +12 -0
- mindspore/ops/operations/manually_defined/ops_def.py +265 -10
- mindspore/ops/operations/math_ops.py +12 -223
- mindspore/ops/operations/nn_ops.py +20 -114
- mindspore/ops/operations/other_ops.py +7 -4
- mindspore/ops/operations/random_ops.py +46 -1
- mindspore/ops/primitive.py +18 -6
- mindspore/ops_generate/arg_dtype_cast.py +2 -0
- mindspore/ops_generate/gen_aclnn_implement.py +11 -11
- mindspore/ops_generate/gen_constants.py +36 -0
- mindspore/ops_generate/gen_ops.py +67 -52
- mindspore/ops_generate/gen_ops_inner_prim.py +1 -1
- mindspore/ops_generate/gen_pyboost_func.py +131 -47
- mindspore/ops_generate/op_proto.py +10 -3
- mindspore/ops_generate/pyboost_utils.py +14 -1
- mindspore/ops_generate/template.py +43 -21
- mindspore/parallel/__init__.py +3 -1
- mindspore/parallel/_auto_parallel_context.py +28 -8
- mindspore/parallel/_cell_wrapper.py +83 -0
- mindspore/parallel/_parallel_serialization.py +47 -19
- mindspore/parallel/_tensor.py +81 -11
- mindspore/parallel/_utils.py +13 -1
- mindspore/parallel/algo_parameter_config.py +5 -5
- mindspore/parallel/checkpoint_transform.py +46 -39
- mindspore/parallel/cluster/process_entity/__init__.py +1 -1
- mindspore/parallel/cluster/process_entity/_api.py +31 -23
- mindspore/parallel/cluster/process_entity/_utils.py +2 -27
- mindspore/parallel/parameter_broadcast.py +3 -4
- mindspore/parallel/shard.py +162 -31
- mindspore/parallel/transform_safetensors.py +993 -0
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/common/constant.py +29 -0
- mindspore/profiler/common/registry.py +47 -0
- mindspore/profiler/common/util.py +28 -0
- mindspore/profiler/dynamic_profiler.py +694 -0
- mindspore/profiler/envprofiling.py +17 -19
- mindspore/profiler/parser/ascend_analysis/constant.py +18 -0
- mindspore/profiler/parser/ascend_analysis/file_manager.py +25 -4
- mindspore/profiler/parser/ascend_analysis/function_event.py +43 -19
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +31 -26
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +56 -10
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +55 -8
- mindspore/profiler/parser/ascend_analysis/path_manager.py +313 -0
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +27 -20
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +9 -2
- mindspore/profiler/parser/ascend_msprof_exporter.py +5 -4
- mindspore/profiler/parser/ascend_timeline_generator.py +27 -25
- mindspore/profiler/parser/base_timeline_generator.py +19 -25
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +25 -12
- mindspore/profiler/parser/framework_parser.py +1 -391
- mindspore/profiler/parser/gpu_analysis/__init__.py +14 -0
- mindspore/profiler/parser/gpu_analysis/function_event.py +44 -0
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +89 -0
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +72 -0
- mindspore/profiler/parser/memory_usage_parser.py +0 -154
- mindspore/profiler/parser/profiler_info.py +78 -6
- mindspore/profiler/profiler.py +153 -0
- mindspore/profiler/profiling.py +280 -412
- mindspore/rewrite/__init__.py +1 -2
- mindspore/rewrite/common/namespace.py +4 -4
- mindspore/rewrite/symbol_tree/symbol_tree.py +3 -3
- mindspore/run_check/_check_version.py +36 -103
- mindspore/safeguard/rewrite_obfuscation.py +591 -247
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/__init__.py +4 -3
- mindspore/train/_utils.py +28 -2
- mindspore/train/amp.py +171 -53
- mindspore/train/callback/__init__.py +2 -2
- mindspore/train/callback/_callback.py +4 -4
- mindspore/train/callback/_checkpoint.py +85 -22
- mindspore/train/callback/_cluster_monitor.py +1 -1
- mindspore/train/callback/_flops_collector.py +1 -0
- mindspore/train/callback/_loss_monitor.py +3 -3
- mindspore/train/callback/_on_request_exit.py +134 -31
- mindspore/train/callback/_summary_collector.py +5 -5
- mindspore/train/callback/_tft_register.py +352 -0
- mindspore/train/dataset_helper.py +7 -3
- mindspore/train/metrics/metric.py +3 -3
- mindspore/train/metrics/roc.py +4 -4
- mindspore/train/mind_ir_pb2.py +44 -39
- mindspore/train/model.py +134 -58
- mindspore/train/serialization.py +336 -112
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +21 -0
- mindspore/utils/utils.py +60 -0
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/METADATA +6 -2
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/RECORD +281 -275
- mindspore/include/c_api/ms/abstract.h +0 -67
- mindspore/include/c_api/ms/attribute.h +0 -197
- mindspore/include/c_api/ms/base/handle_types.h +0 -43
- mindspore/include/c_api/ms/base/macros.h +0 -32
- mindspore/include/c_api/ms/base/status.h +0 -33
- mindspore/include/c_api/ms/base/types.h +0 -283
- mindspore/include/c_api/ms/context.h +0 -102
- mindspore/include/c_api/ms/graph.h +0 -160
- mindspore/include/c_api/ms/node.h +0 -606
- mindspore/include/c_api/ms/tensor.h +0 -161
- mindspore/include/c_api/ms/value.h +0 -84
- mindspore/mindspore_shared_lib.dll +0 -0
- mindspore/nn/extend/basic.py +0 -140
- mindspore/nn/extend/embedding.py +0 -143
- mindspore/nn/extend/layer/normalization.py +0 -109
- mindspore/nn/extend/pooling.py +0 -117
- mindspore/nn/layer/embedding_service.py +0 -531
- mindspore/ops/_op_impl/aicpu/strided_slice_v2.py +0 -93
- mindspore/ops/_op_impl/aicpu/strided_slice_v2_grad.py +0 -66
- mindspore/ops/extend/__init__.py +0 -53
- mindspore/ops/extend/array_func.py +0 -218
- mindspore/ops/extend/math_func.py +0 -76
- mindspore/ops/extend/nn_func.py +0 -308
- mindspore/ops/silent_check.py +0 -162
- mindspore/profiler/parser/msadvisor_analyzer.py +0 -82
- mindspore/profiler/parser/msadvisor_parser.py +0 -240
- mindspore/train/callback/_mindio_ttp.py +0 -443
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/WHEEL +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/top_level.txt +0 -0
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"""Operators for debug function."""
|
|
17
17
|
|
|
18
18
|
from mindspore.ops.operations.debug_ops import Print
|
|
19
|
+
from mindspore.common.tensor import Tensor
|
|
20
|
+
from mindspore.ops import operations as P
|
|
19
21
|
from .._primitive_cache import _get_cache_prim
|
|
20
22
|
|
|
21
23
|
|
|
@@ -26,6 +28,8 @@ def print_(*input_x):
|
|
|
26
28
|
Once set, the output will be saved in the file specified by print_file_path.
|
|
27
29
|
:func:`mindspore.parse_print` can be employed to reload the data.
|
|
28
30
|
For more information, please refer to :func:`mindspore.set_context` and :func:`mindspore.parse_print`.
|
|
31
|
+
In Ascend platform with graph mode, can set environment variables `MS_DUMP_SLICE_SIZE` and `MS_DUMP_WAIT_TIME`
|
|
32
|
+
to solve operator execution failure when outputting big tensor or outputting tensor intensively.
|
|
29
33
|
|
|
30
34
|
Note:
|
|
31
35
|
In pynative mode, please use python print function.
|
|
@@ -64,6 +68,114 @@ def print_(*input_x):
|
|
|
64
68
|
return print_op(*input_x)
|
|
65
69
|
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
|
|
72
|
+
def tensordump(file_name, tensor, mode='out'):
|
|
73
|
+
"""
|
|
74
|
+
Save Tensor in numpy's npy format.
|
|
75
|
+
|
|
76
|
+
In Parallel situation, tensordump will dump slice of data at each rank.
|
|
77
|
+
|
|
78
|
+
In Ascend platform with graph mode,
|
|
79
|
+
Your code OpA --> OpB may compiled as OpA --> RedistributionOps --> OpB.
|
|
80
|
+
|
|
81
|
+
Note: The redistribution operator is introduced,
|
|
82
|
+
Due to inter-device communication and shard strategies in the static graph parallel scenario.
|
|
83
|
+
|
|
84
|
+
In case of OpA --> OpB, the dump data of OpA's output is equal to OpB's input.
|
|
85
|
+
|
|
86
|
+
But in case of OpA --> RedistributionOps --> OpB,
|
|
87
|
+
The dump data of OpA's output is not equal to OpB's input (Due to the redistribution operators).
|
|
88
|
+
So the parameter mode is to handle this situation.
|
|
89
|
+
|
|
90
|
+
Assuming OpA's output is used as both tensordump's input parameter and OpB's input parameter.
|
|
91
|
+
Different requirements of saving dump data can be achieved by configuring parameter mode:
|
|
92
|
+
|
|
93
|
+
- If the mode is 'out', the dump data contains only OpA's output slice.
|
|
94
|
+
- If the mode is 'all', the dump data contains both OpA's output slice and OpB's input slice.
|
|
95
|
+
- If the mode is 'in', the dump data contains only OpB's input slice.
|
|
96
|
+
|
|
97
|
+
For mode 'all' or 'in', the input slice npy file format is: id_fileName_cNodeID_dumpMode_rankID.npy.
|
|
98
|
+
|
|
99
|
+
For mode 'out' or 'all' the output slice npy file format is: id_filename.npy.
|
|
100
|
+
|
|
101
|
+
- id: An auto increment ID.
|
|
102
|
+
- fileName: Value of the parameter file_name
|
|
103
|
+
(if parameter file_name is a user-specified path, the value of fileName is the last level of the path).
|
|
104
|
+
- cNodeID: The cnode ID in ir graph of step_parallel_end.ir.
|
|
105
|
+
- dumpMode: Value of the parameter mode.
|
|
106
|
+
- rankID: Logical device id.
|
|
107
|
+
|
|
108
|
+
Note:
|
|
109
|
+
- The operator of tensordump doesn't support in control flow.
|
|
110
|
+
- If current parallel mode is STAND_ALONE, mode should only be 'out'.
|
|
111
|
+
- Parameter mode will be set to 'out' if user doesn't configure it.
|
|
112
|
+
- This function is used for debugging.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
file_name (str): The path of the npy file saves.
|
|
116
|
+
tensor (Tensor): The tensor that user want to dump.
|
|
117
|
+
mode (str, optional): Used to control tensordump behavior, available value is one of ['in', 'out', 'all'].
|
|
118
|
+
Default value is ``out``.
|
|
119
|
+
|
|
120
|
+
Raises:
|
|
121
|
+
TypeError: If `file_name` is not str.
|
|
122
|
+
TypeError: If `tensor` is not Tensor.
|
|
123
|
+
TypeError: If `mode` is not str.
|
|
124
|
+
ValueError: If `mode` is not in one of ['in', 'out', 'all'].
|
|
125
|
+
|
|
126
|
+
Supported Platforms:
|
|
127
|
+
``Ascend``
|
|
128
|
+
|
|
129
|
+
Examples:
|
|
130
|
+
.. note::
|
|
131
|
+
Using msrun command to run below example: msrun --worker_num=2 --local_worker_num=2 --master_port=11450
|
|
132
|
+
--log_dir=msrun_log --join=True --cluster_time_out=300 tensordump_example.py
|
|
133
|
+
|
|
134
|
+
>>> import numpy as np
|
|
135
|
+
>>> import mindspore as ms
|
|
136
|
+
>>> from mindspore import nn, Tensor, ops, context
|
|
137
|
+
>>> from mindspore.ops import operations as P
|
|
138
|
+
>>> from mindspore.communication import init, get_rank
|
|
139
|
+
>>> init()
|
|
140
|
+
>>> rank_id = get_rank()
|
|
141
|
+
>>> dump_path = f'dumps/rank_{rank_id}/mul1_mul2.npy'
|
|
142
|
+
>>> class Net(nn.Cell):
|
|
143
|
+
... def __init__(self, strategy1, strategy2):
|
|
144
|
+
... super(Net, self).__init__()
|
|
145
|
+
... self.matmul1 = P.MatMul().shard(strategy1)
|
|
146
|
+
... self.matmul2 = P.MatMul().shard(strategy2)
|
|
147
|
+
...
|
|
148
|
+
... def construct(self, x, y, b):
|
|
149
|
+
... out1 = self.matmul1(x, y)
|
|
150
|
+
... ops.tensordump(dump_path, out1, 'all')
|
|
151
|
+
... out2 = self.matmul2(out1, b)
|
|
152
|
+
... return out2
|
|
153
|
+
...
|
|
154
|
+
>>> ms.set_context(mode=ms.GRAPH_MODE, save_graphs=2)
|
|
155
|
+
>>> context.set_auto_parallel_context(parallel_mode='semi_auto_parallel', full_batch=True)
|
|
156
|
+
>>> strategy1 = ((1, 2), (2, 1))
|
|
157
|
+
>>> strategy2 = ((1, 2), (2, 1))
|
|
158
|
+
>>> net = Net(strategy1, strategy2)
|
|
159
|
+
>>> x = Tensor(0.1 * np.random.randn(64, 64).astype(np.float32))
|
|
160
|
+
>>> y = Tensor(0.1 * np.random.randn(64, 64).astype(np.float32))
|
|
161
|
+
>>> b = Tensor(0.1 * np.random.randn(64, 64).astype(np.float32))
|
|
162
|
+
>>> out = net(x, y, b)
|
|
163
|
+
>>> print(f"out shape is: {out.shape}")
|
|
164
|
+
>>> matmul1_output_slice = np.load('0_mul1_mul2.npy') # load matmul1's output slice
|
|
165
|
+
>>> matmul2_input_slice = np.load('1_mul1_mul2_CNode_64_all_rank_0.npy') # load matmul2's input slice
|
|
166
|
+
"""
|
|
167
|
+
if not isinstance(file_name, str):
|
|
168
|
+
raise TypeError(f"Parameter file_name should only be build_in str type but got: {type(file_name)}")
|
|
169
|
+
if not isinstance(tensor, Tensor):
|
|
170
|
+
raise TypeError(f"Parameter tensor should only be Tensor type, but got: {type(tensor)}")
|
|
171
|
+
if not isinstance(mode, str):
|
|
172
|
+
raise TypeError(f"Parameter mode should only be build_in str type, but got: {type(mode)}")
|
|
173
|
+
mode_list = ['out', 'in', 'all']
|
|
174
|
+
if mode not in mode_list:
|
|
175
|
+
raise ValueError(f"Parameter mode should in {mode_list}, but got {mode}")
|
|
176
|
+
_tensordump = _get_cache_prim(P.TensorDump)(input_output=mode)
|
|
177
|
+
return _tensordump(file_name, tensor)
|
|
178
|
+
|
|
179
|
+
__all__ = ['print_', 'tensordump']
|
|
68
180
|
|
|
69
181
|
__all__.sort()
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
# ============================================================================
|
|
15
15
|
"""Defines Fast Fourier Transform operators with functional form."""
|
|
16
|
-
from mindspore.ops.auto_generate import fft, fft2, fftn, ifft, ifft2, ifftn, fftshift, ifftshift,
|
|
16
|
+
from mindspore.ops.auto_generate import fft, fft2, fftn, ifft, ifft2, ifftn, fftshift, ifftshift, \
|
|
17
|
+
rfft, irfft, rfft2, irfft2, rfftn, irfftn, hfft, ihfft, hfft2, ihfft2, hfftn, ihfftn, fftfreq, rfftfreq
|
|
17
18
|
|
|
18
19
|
__all__ = [
|
|
19
20
|
'fftshift',
|
|
@@ -25,7 +26,19 @@ __all__ = [
|
|
|
25
26
|
'ifft2',
|
|
26
27
|
'ifftn',
|
|
27
28
|
'rfft',
|
|
28
|
-
'irfft'
|
|
29
|
+
'irfft',
|
|
30
|
+
'rfft2',
|
|
31
|
+
'irfft2',
|
|
32
|
+
'rfftn',
|
|
33
|
+
'irfftn',
|
|
34
|
+
'hfft',
|
|
35
|
+
'ihfft',
|
|
36
|
+
'hfft2',
|
|
37
|
+
'ihfft2',
|
|
38
|
+
'hfftn',
|
|
39
|
+
'ihfftn',
|
|
40
|
+
'fftfreq',
|
|
41
|
+
'rfftfreq'
|
|
29
42
|
]
|
|
30
43
|
|
|
31
44
|
__all__.sort()
|
|
@@ -22,6 +22,7 @@ from mindspore.common import Tensor
|
|
|
22
22
|
from mindspore.common import dtype as mstype
|
|
23
23
|
from mindspore.nn.cell import Cell
|
|
24
24
|
from mindspore.nn.grad.cell_grad import _LinearizeInner
|
|
25
|
+
from mindspore.ops.operations.other_ops import stop_gradient_
|
|
25
26
|
from mindspore.ops.primitive import constexpr, _primexpr
|
|
26
27
|
from mindspore.ops.function.array_func import ones, expand_dims, size, reshape, broadcast_to, transpose, zeros
|
|
27
28
|
from mindspore.ops.composite import _Vmap, _Grad, _TaylorOperation, GradOperation
|
|
@@ -658,7 +659,7 @@ def _check_jvp_input_v_len(inputs_len, v_len):
|
|
|
658
659
|
|
|
659
660
|
def jvp(fn, inputs, v, has_aux=False):
|
|
660
661
|
"""
|
|
661
|
-
Compute the jacobian-vector-product of the given network.
|
|
662
|
+
Compute the jacobian-vector-product of the given network. The calculation procedure of JVP can be found in
|
|
662
663
|
`forward-mode differentiation
|
|
663
664
|
<https://www.mindspore.cn/docs/en/master/design/programming_paradigm.html#forward-mode-ad>`_.
|
|
664
665
|
|
|
@@ -1405,7 +1406,7 @@ def stop_gradient(value):
|
|
|
1405
1406
|
[[1.4100001 1.6 6.5999994]
|
|
1406
1407
|
[1.4100001 1.6 6.5999994]]
|
|
1407
1408
|
"""
|
|
1408
|
-
return
|
|
1409
|
+
return stop_gradient_(value)
|
|
1409
1410
|
|
|
1410
1411
|
|
|
1411
1412
|
__all__ = [
|