mindspore 2.6.0__cp310-cp310-win_amd64.whl → 2.7.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 +2 -2
- 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 +42 -11
- mindspore/_extends/builtin_operations.py +3 -3
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -2
- mindspore/_extends/parse/parser.py +64 -83
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +47 -14
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/_extends/pijit/pijit_func_white_list.py +2 -5
- mindspore/amp.py +4 -22
- 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/boost/adasum.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +4 -4
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +43 -12
- mindspore/common/_grad_function.py +2 -1
- mindspore/common/_pijit_context.py +28 -7
- mindspore/common/_stub_tensor.py +1 -209
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +177 -52
- mindspore/common/_utils.py +9 -1
- mindspore/common/api.py +338 -208
- mindspore/common/dtype.py +108 -57
- mindspore/common/dump.py +11 -16
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +17 -23
- mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
- mindspore/common/file_system.py +59 -9
- mindspore/common/generator.py +2 -3
- mindspore/common/hook_handle.py +33 -5
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +27 -29
- mindspore/common/recompute.py +5 -7
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +84 -133
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +47 -38
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +38 -4
- mindspore/dataset/engine/datasets.py +350 -322
- mindspore/dataset/engine/datasets_user_defined.py +69 -23
- mindspore/dataset/engine/iterators.py +2 -2
- mindspore/dataset/engine/obs/config_loader.py +2 -2
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +10 -6
- mindspore/dataset/vision/__init__.py +1 -1
- mindspore/dataset/vision/py_transforms.py +8 -8
- mindspore/dataset/vision/transforms.py +17 -5
- mindspore/dataset/vision/utils.py +632 -21
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -1
- mindspore/device_context/ascend/op_tuning.py +35 -1
- mindspore/device_context/gpu/__init__.py +2 -2
- mindspore/device_context/gpu/device.py +1 -1
- mindspore/device_context/gpu/op_precision.py +4 -2
- mindspore/device_context/gpu/op_tuning.py +6 -3
- mindspore/device_manager.py +16 -9
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +5 -4
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/optim/adadelta.py +13 -20
- mindspore/experimental/optim/adagrad.py +15 -22
- mindspore/experimental/optim/adam.py +17 -24
- mindspore/experimental/optim/adamax.py +14 -22
- mindspore/experimental/optim/adamw.py +28 -34
- mindspore/experimental/optim/asgd.py +15 -25
- mindspore/experimental/optim/lr_scheduler.py +27 -45
- mindspore/experimental/optim/nadam.py +14 -24
- mindspore/experimental/optim/optimizer.py +13 -23
- mindspore/experimental/optim/radam.py +18 -24
- mindspore/experimental/optim/rmsprop.py +14 -25
- mindspore/experimental/optim/rprop.py +15 -26
- mindspore/experimental/optim/sgd.py +9 -19
- mindspore/hal/__init__.py +4 -4
- mindspore/hal/contiguous_tensors_handle.py +2 -2
- mindspore/hal/memory.py +1 -0
- mindspore/include/api/cell.h +65 -5
- mindspore/include/api/cfg.h +24 -7
- mindspore/include/api/context.h +1 -0
- mindspore/include/api/delegate.h +10 -2
- mindspore/include/api/dual_abi_helper.h +100 -19
- mindspore/include/api/graph.h +14 -1
- mindspore/include/api/kernel.h +16 -3
- mindspore/include/api/kernel_api.h +9 -1
- mindspore/include/api/metrics/accuracy.h +9 -0
- mindspore/include/api/model.h +8 -1
- mindspore/include/api/model_group.h +4 -0
- mindspore/include/api/model_parallel_runner.h +2 -0
- mindspore/include/api/status.h +48 -10
- mindspore/include/api/types.h +8 -3
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/constants.h +9 -0
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +61 -11
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mindspore_ops_host.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +4 -44
- mindspore/mint/distributed/__init__.py +5 -0
- mindspore/mint/distributed/distributed.py +425 -19
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +163 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +125 -101
- mindspore/mint/nn/layer/normalization.py +11 -25
- mindspore/mint/optim/adam.py +19 -18
- mindspore/mint/optim/adamw.py +14 -8
- mindspore/mint/optim/sgd.py +5 -5
- 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/nn/cell.py +488 -620
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +36 -36
- mindspore/nn/layer/basic.py +74 -77
- mindspore/nn/layer/channel_shuffle.py +4 -4
- mindspore/nn/layer/combined.py +4 -2
- mindspore/nn/layer/conv.py +86 -85
- mindspore/nn/layer/dense.py +9 -7
- mindspore/nn/layer/embedding.py +50 -52
- mindspore/nn/layer/image.py +38 -40
- mindspore/nn/layer/math.py +111 -112
- mindspore/nn/layer/normalization.py +56 -44
- mindspore/nn/layer/pooling.py +58 -63
- mindspore/nn/layer/rnn_cells.py +33 -33
- mindspore/nn/layer/rnns.py +56 -56
- mindspore/nn/layer/thor_layer.py +74 -73
- mindspore/nn/layer/transformer.py +11 -1
- mindspore/nn/learning_rate_schedule.py +20 -20
- mindspore/nn/loss/loss.py +79 -81
- mindspore/nn/optim/adam.py +2 -4
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/lamb.py +1 -3
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/tft_wrapper.py +2 -3
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -1
- mindspore/nn/probability/distribution/poisson.py +2 -1
- mindspore/nn/sparse/sparse.py +3 -3
- mindspore/nn/wrap/cell_wrapper.py +73 -42
- mindspore/nn/wrap/grad_reducer.py +37 -52
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +7 -7
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.py +1 -1
- mindspore/numpy/utils_const.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
- mindspore/ops/_op_impl/cpu/__init__.py +1 -0
- mindspore/{experimental/es/__init__.py → ops/_op_impl/cpu/joinedstr_op.py} +12 -6
- mindspore/ops/_vmap/vmap_array_ops.py +6 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +29 -10
- mindspore/ops/auto_generate/gen_extend_func.py +5 -55
- mindspore/ops/auto_generate/gen_ops_def.py +753 -273
- mindspore/ops/auto_generate/gen_ops_prim.py +1687 -958
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +9 -5
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
- mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
- mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
- mindspore/ops/function/__init__.py +4 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +17 -100
- mindspore/ops/function/debug_func.py +8 -5
- mindspore/ops/function/grad/grad_func.py +5 -13
- mindspore/ops/function/math_func.py +65 -399
- mindspore/ops/function/nn_func.py +44 -61
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +31 -4
- mindspore/ops/functional.py +2 -3
- mindspore/ops/functional_overload.py +486 -18
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +5 -2
- mindspore/ops/operations/_custom_ops_utils.py +675 -8
- mindspore/ops/operations/_inner_ops.py +14 -18
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +4 -50
- mindspore/ops/operations/comm_ops.py +186 -41
- mindspore/ops/operations/custom_ops.py +244 -175
- mindspore/ops/operations/debug_ops.py +55 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +27 -28
- mindspore/ops/operations/math_ops.py +8 -9
- mindspore/ops/operations/nn_ops.py +6 -7
- mindspore/ops/primitive.py +9 -20
- mindspore/ops/tensor_method.py +52 -11
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
- mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
- mindspore/ops_generate/api/functions_cc_generator.py +58 -10
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
- mindspore/ops_generate/common/base_generator.py +14 -0
- mindspore/ops_generate/common/gen_constants.py +7 -2
- mindspore/ops_generate/common/gen_utils.py +0 -19
- mindspore/ops_generate/common/op_proto.py +11 -4
- mindspore/ops_generate/common/template.py +88 -11
- mindspore/ops_generate/gen_ops.py +1 -1
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
- mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -16
- mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
- mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
- mindspore/parallel/_auto_parallel_context.py +9 -17
- mindspore/parallel/_cell_wrapper.py +106 -40
- mindspore/parallel/_parallel_serialization.py +4 -3
- mindspore/parallel/_ps_context.py +4 -6
- mindspore/parallel/_tensor.py +167 -12
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/transformer.py +17 -12
- mindspore/parallel/_utils.py +5 -11
- mindspore/parallel/auto_parallel.py +33 -12
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +5 -1
- mindspore/parallel/cluster/process_entity/_api.py +88 -49
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +48 -7
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +7 -6
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +50 -14
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -14
- mindspore/parallel/shard.py +9 -23
- mindspore/parallel/transform_safetensors.py +468 -174
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
- mindspore/profiler/analysis/task_manager.py +1 -1
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +10 -9
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +43 -23
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
- mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
- mindspore/profiler/common/constant.py +16 -0
- mindspore/profiler/common/msprof_cmd_tool.py +2 -2
- mindspore/profiler/common/path_manager.py +9 -0
- mindspore/profiler/common/profiler_context.py +50 -29
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_meta_data.py +1 -0
- mindspore/profiler/common/profiler_op_analyse.py +239 -0
- mindspore/profiler/common/profiler_output_path.py +23 -8
- mindspore/profiler/common/profiler_parameters.py +128 -35
- mindspore/profiler/dynamic_profile/__init__.py +0 -0
- mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
- mindspore/profiler/dynamic_profiler.py +374 -338
- mindspore/profiler/envprofiler.py +42 -12
- mindspore/profiler/experimental_config.py +112 -7
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/cpu_profiler.py +10 -4
- mindspore/profiler/platform/npu_profiler.py +30 -20
- mindspore/profiler/profiler.py +218 -154
- mindspore/profiler/profiler_action_controller.py +65 -77
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/profiler/schedule.py +10 -4
- mindspore/rewrite/common/config.py +1 -0
- mindspore/rewrite/common/namer.py +1 -0
- mindspore/rewrite/common/namespace.py +1 -0
- mindspore/rewrite/node/node.py +31 -11
- mindspore/rewrite/parsers/assign_parser.py +1 -1
- mindspore/rewrite/symbol_tree/symbol_tree.py +2 -2
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +8 -6
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +87 -45
- mindspore/runtime/memory.py +22 -30
- mindspore/runtime/thread_bind_core.py +299 -165
- mindspore/safeguard/rewrite_obfuscation.py +12 -13
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +9 -5
- mindspore/train/amp.py +43 -23
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_callback.py +2 -1
- mindspore/train/callback/_checkpoint.py +4 -14
- mindspore/train/callback/_flops_collector.py +11 -7
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +72 -18
- mindspore/train/data_sink.py +15 -6
- mindspore/train/dataset_helper.py +14 -5
- mindspore/train/model.py +49 -47
- mindspore/train/serialization.py +168 -126
- mindspore/train/summary/summary_record.py +13 -2
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +3 -2
- mindspore/utils/dryrun.py +0 -6
- mindspore/utils/runtime_execution_order_check.py +162 -78
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +14 -17
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/RECORD +400 -439
- mindspore/_deprecated/jit.py +0 -198
- mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
- mindspore/communication/_hccl_management.py +0 -297
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- mindspore/profiler/common/validator/__init__.py +0 -14
- mindspore/profiler/common/validator/validate_path.py +0 -84
- mindspore/profiler/parser/__init__.py +0 -14
- mindspore/profiler/parser/aicpu_data_parser.py +0 -272
- mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
- mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
- mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
- mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
- mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
- mindspore/profiler/parser/ascend_flops_generator.py +0 -116
- mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
- mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
- mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
- mindspore/profiler/parser/ascend_op_generator.py +0 -334
- mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
- mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
- mindspore/profiler/parser/base_timeline_generator.py +0 -483
- mindspore/profiler/parser/container.py +0 -229
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
- mindspore/profiler/parser/flops_parser.py +0 -531
- mindspore/profiler/parser/framework_enum.py +0 -111
- mindspore/profiler/parser/framework_parser.py +0 -464
- mindspore/profiler/parser/framework_struct.py +0 -61
- mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
- mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
- mindspore/profiler/parser/hccl_parser.py +0 -573
- mindspore/profiler/parser/hwts_log_parser.py +0 -122
- mindspore/profiler/parser/integrator.py +0 -526
- mindspore/profiler/parser/memory_usage_parser.py +0 -277
- mindspore/profiler/parser/minddata_analyzer.py +0 -800
- mindspore/profiler/parser/minddata_parser.py +0 -186
- mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
- mindspore/profiler/parser/op_intermediate_parser.py +0 -149
- mindspore/profiler/parser/optime_parser.py +0 -250
- mindspore/profiler/parser/profiler_info.py +0 -213
- mindspore/profiler/parser/step_trace_parser.py +0 -666
- mindspore/utils/hooks.py +0 -81
- /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
# ============================================================================
|
|
15
15
|
|
|
16
16
|
"""Inner operators."""
|
|
17
|
-
from types import FunctionType, MethodType
|
|
18
17
|
from collections.abc import Iterable
|
|
19
|
-
import os
|
|
20
18
|
import weakref
|
|
21
19
|
import numpy as np
|
|
22
20
|
|
|
@@ -27,18 +25,17 @@ from mindspore.ops.operations._scalar_ops import bit_or, bit_and
|
|
|
27
25
|
from mindspore.ops import signature as sig
|
|
28
26
|
from mindspore.ops.operations.math_ops import _infer_shape_reduce
|
|
29
27
|
from mindspore.ops.primitive import PrimitiveWithCheck, PrimitiveWithInfer, prim_attr_register, Primitive, \
|
|
30
|
-
|
|
28
|
+
_check_contains_variable
|
|
31
29
|
from mindspore._c_expression import TensorPy as Tensor_
|
|
32
30
|
from mindspore._c_expression import typing, HookType
|
|
33
|
-
from mindspore._c_expression import pyboost_generator
|
|
31
|
+
from mindspore._c_expression import pyboost_generator, pyboost_cell_backward_hook
|
|
34
32
|
from mindspore import _checkparam as validator
|
|
35
33
|
from mindspore.common import dtype as mstype
|
|
36
34
|
from mindspore.common.parameter import Parameter
|
|
37
|
-
from mindspore.common._stub_tensor import _convert_stub
|
|
38
35
|
from mindspore.communication.management import GlobalComm, get_rank, _get_group, get_group_size
|
|
39
36
|
from mindspore.common.api import _pynative_executor
|
|
40
|
-
from ..auto_generate import TensorCopySlices, SiLU, Cummin, TopKRouter,
|
|
41
|
-
|
|
37
|
+
from ..auto_generate import TensorCopySlices, SiLU, Cummin, TopKRouter, TopPRouter, ExtractImagePatches, \
|
|
38
|
+
ApplyCamePart1, ApplyCamePart2, ApplyCamePart3, ApplyCamePart4
|
|
42
39
|
|
|
43
40
|
# Bit operation
|
|
44
41
|
bit_and = bit_and()
|
|
@@ -78,7 +75,7 @@ class Generator(Primitive):
|
|
|
78
75
|
def __call__(self, cmd, inputs):
|
|
79
76
|
if cmd == 0: # step cmd
|
|
80
77
|
return inputs[0], inputs[1]
|
|
81
|
-
return
|
|
78
|
+
return pyboost_generator(self, [cmd, inputs])
|
|
82
79
|
|
|
83
80
|
|
|
84
81
|
class Quant(PrimitiveWithInfer):
|
|
@@ -1568,10 +1565,11 @@ class CellBackwardHook(PrimitiveWithInfer):
|
|
|
1568
1565
|
self.add_prim_attr("cell_id", cell_id)
|
|
1569
1566
|
self.grad_output = None
|
|
1570
1567
|
|
|
1571
|
-
def __call__(self,
|
|
1572
|
-
|
|
1573
|
-
if not args:
|
|
1574
|
-
|
|
1568
|
+
def __call__(self, args):
|
|
1569
|
+
is_tuple = True
|
|
1570
|
+
if not isinstance(args, tuple):
|
|
1571
|
+
args = (args,)
|
|
1572
|
+
is_tuple = False
|
|
1575
1573
|
|
|
1576
1574
|
# Collect the indices and values of arguments that are instances of Tensor
|
|
1577
1575
|
tensors_idx = []
|
|
@@ -1581,20 +1579,18 @@ class CellBackwardHook(PrimitiveWithInfer):
|
|
|
1581
1579
|
tensors_idx.append(i)
|
|
1582
1580
|
tensors.append(arg)
|
|
1583
1581
|
|
|
1584
|
-
# If there are no Tensor arguments, return
|
|
1582
|
+
# If there are no Tensor arguments, return original args
|
|
1585
1583
|
if not tensors:
|
|
1586
|
-
return args
|
|
1584
|
+
return args if is_tuple else args[0]
|
|
1587
1585
|
|
|
1588
|
-
new_tensors =
|
|
1589
|
-
if not isinstance(new_tensors, tuple):
|
|
1590
|
-
new_tensors = (new_tensors,)
|
|
1586
|
+
new_tensors = pyboost_cell_backward_hook(self, (tensors,))
|
|
1591
1587
|
|
|
1592
1588
|
# Replace the original Tensor arguments with the processed ones
|
|
1593
1589
|
arg_list = list(args)
|
|
1594
1590
|
for idx, val in zip(tensors_idx, new_tensors):
|
|
1595
1591
|
arg_list[idx] = val
|
|
1596
1592
|
|
|
1597
|
-
return
|
|
1593
|
+
return tuple(arg_list) if is_tuple else arg_list[0]
|
|
1598
1594
|
|
|
1599
1595
|
def infer_shape(self, *inputs_shape):
|
|
1600
1596
|
if len(inputs_shape) == 1:
|
|
@@ -42,7 +42,7 @@ from ..auto_generate import (
|
|
|
42
42
|
NonZero, ResizeNearestNeighbor, Identity, Split, CumSum, CumProd,
|
|
43
43
|
MaskedSelect, Cummax, Cummin, Argmin, Concat, UnsortedSegmentSum, UniqueConsecutive,
|
|
44
44
|
ScalarToTensor, Triu, BroadcastTo, StridedSlice, Select, TopkExt,
|
|
45
|
-
SearchSorted, Meshgrid, Squeeze, Slice, TransposeExtView)
|
|
45
|
+
SearchSorted, Meshgrid, Squeeze, Slice, TransposeExtView, MaskedScatter)
|
|
46
46
|
from .manually_defined import Rank, Shape, Tile, Cast, Ones, Zeros, TypeAs
|
|
47
47
|
from ..auto_generate import ArgMaxWithValue, ArgMinWithValue
|
|
48
48
|
from ..auto_generate import TensorScatterElements as TensorScatterElementsExt
|
|
@@ -1048,11 +1048,11 @@ class Fill(PrimitiveWithCheck):
|
|
|
1048
1048
|
self.init_prim_io_names(inputs=['type', 'shape', 'value'], outputs=['y'])
|
|
1049
1049
|
|
|
1050
1050
|
def __call__(self, dtype, dims, x):
|
|
1051
|
-
if dtype not in mstype.all_types
|
|
1051
|
+
if dtype not in mstype.all_types:
|
|
1052
1052
|
raise TypeError(
|
|
1053
1053
|
f"For \'{self.name}\', the supported data type is ['bool', 'int8', 'int16', 'int32', 'int64', 'uint8', "
|
|
1054
1054
|
"'uint16', 'uint32', 'uint64','float16', 'float32', 'float64'], but got an invalid dtype!.")
|
|
1055
|
-
x_nptype = mstype.
|
|
1055
|
+
x_nptype = mstype._dtype_to_nptype(dtype) # pylint:disable=protected-access
|
|
1056
1056
|
if not isinstance(dims, Tensor) and not isinstance(dims, tuple):
|
|
1057
1057
|
raise TypeError(f"For \'{self.name}\', input[1] must be tensor.")
|
|
1058
1058
|
if not isinstance(x, Tensor) and not isinstance(x, float) and not isinstance(x, int):
|
|
@@ -1065,7 +1065,7 @@ class Fill(PrimitiveWithCheck):
|
|
|
1065
1065
|
return Tensor(ret, dtype=dtype)
|
|
1066
1066
|
|
|
1067
1067
|
def infer_value(self, dtype, dims, x):
|
|
1068
|
-
x_nptype = mstype.
|
|
1068
|
+
x_nptype = mstype._dtype_to_nptype(dtype) # pylint:disable=protected-access
|
|
1069
1069
|
if dims is not None and None not in dims and x is not None:
|
|
1070
1070
|
if isinstance(dims, Tensor):
|
|
1071
1071
|
dims = dims.asnumpy()
|
|
@@ -3974,52 +3974,6 @@ class RangeV2(Primitive):
|
|
|
3974
3974
|
validator.check_positive_int(maxlen, "maxlen", self.name)
|
|
3975
3975
|
|
|
3976
3976
|
|
|
3977
|
-
class MaskedScatter(Primitive):
|
|
3978
|
-
"""
|
|
3979
|
-
Updates the value in the input with value in `updates` according to the `mask`.
|
|
3980
|
-
|
|
3981
|
-
.. warning::
|
|
3982
|
-
This is an experimental API that is subject to change or deletion.
|
|
3983
|
-
|
|
3984
|
-
Inputs:
|
|
3985
|
-
- **x** (Tensor): The input Tensor to be updated.
|
|
3986
|
-
- **mask** (Tensor[bool]): The mask Tensor indicating which elements should be modified or replaced.
|
|
3987
|
-
The shapes of `mask` and `x` must be the same or broadcastable.
|
|
3988
|
-
- **updates** (Tensor): The values to scatter into the target tensor `x`. It has the same data type as `x`. The
|
|
3989
|
-
number of elements must be greater than or equal to the number of True's in `mask`.
|
|
3990
|
-
|
|
3991
|
-
Outputs:
|
|
3992
|
-
Tensor, with the same type and shape as `x`.
|
|
3993
|
-
|
|
3994
|
-
Raises:
|
|
3995
|
-
TypeError: If `x`, `mask` or `updates` is not a Tensor.
|
|
3996
|
-
TypeError: If data type of `x` is not be supported.
|
|
3997
|
-
TypeError: If dtype of `mask` is not bool.
|
|
3998
|
-
TypeError: If the dim of `x` less than the dim of `mask`.
|
|
3999
|
-
ValueError: If `mask` can not be broadcastable to `x`.
|
|
4000
|
-
ValueError: If the number of elements in `updates` is less than number of True's in `mask`.
|
|
4001
|
-
|
|
4002
|
-
Supported Platforms:
|
|
4003
|
-
``Ascend`` ``CPU``
|
|
4004
|
-
|
|
4005
|
-
Examples:
|
|
4006
|
-
>>> import mindspore
|
|
4007
|
-
>>> import numpy as np
|
|
4008
|
-
>>> from mindspore import Tensor, ops
|
|
4009
|
-
>>> input_x = Tensor(np.array([1., 2., 3., 4.]), mindspore.float32)
|
|
4010
|
-
>>> mask = Tensor(np.array([True, True, False, True]), mindspore.bool_)
|
|
4011
|
-
>>> updates = Tensor(np.array([5., 6., 7.]), mindspore.float32)
|
|
4012
|
-
>>> output = ops.MaskedScatter()(input_x, mask, updates)
|
|
4013
|
-
>>> print(output)
|
|
4014
|
-
[5. 6. 3. 7.]
|
|
4015
|
-
"""
|
|
4016
|
-
|
|
4017
|
-
@prim_attr_register
|
|
4018
|
-
def __init__(self):
|
|
4019
|
-
"""Initialize MaskedScatter"""
|
|
4020
|
-
self.init_prim_io_names(inputs=['x', 'mask', 'updates'], outputs=['y'])
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
3977
|
class _TensorScatterOp(PrimitiveWithInfer):
|
|
4024
3978
|
"""
|
|
4025
3979
|
Defines TensorScatter Base Operators
|
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
from __future__ import absolute_import
|
|
19
19
|
from __future__ import division
|
|
20
20
|
|
|
21
|
-
import os
|
|
22
21
|
from mindspore.common import Tensor
|
|
23
22
|
from mindspore import _checkparam as validator
|
|
24
|
-
from mindspore.communication.management import get_rank, get_group_size, GlobalComm, _get_group
|
|
23
|
+
from mindspore.communication.management import get_rank, get_group_size, GlobalComm, _get_group
|
|
25
24
|
from mindspore.common import dtype as mstype
|
|
26
25
|
from mindspore.ops.primitive import PrimitiveWithInfer, PrimitiveWithCheck, Primitive, prim_attr_register
|
|
27
26
|
from mindspore.common.api import context
|
|
@@ -98,17 +97,6 @@ def check_collective_target_dtype(data_name, data_dtype, prim_name):
|
|
|
98
97
|
validator.check_tensor_dtype_valid(data_name, data_dtype, valid_dtype, prim_name)
|
|
99
98
|
|
|
100
99
|
|
|
101
|
-
def check_hcom_group_valid(group, prim_name=None):
|
|
102
|
-
"""Check if hcom group is valid."""
|
|
103
|
-
msg_prefix = f"For '{prim_name}', the" if prim_name else "The"
|
|
104
|
-
sim_level = os.getenv("MS_SIMULATION_LEVEL")
|
|
105
|
-
no_sim = (sim_level is None or sim_level.strip() == '')
|
|
106
|
-
if no_sim and (not _host_distribute()) and context.get_context("mode") == context.PYNATIVE_MODE and \
|
|
107
|
-
group != GlobalComm.WORLD_COMM_GROUP:
|
|
108
|
-
raise RuntimeError(f"{msg_prefix} 'group' only support 'hccl_world_group' in pynative mode, but got "
|
|
109
|
-
f"'group': {group}. Please start by using mpi-run.")
|
|
110
|
-
|
|
111
|
-
|
|
112
100
|
class AllReduce(Primitive):
|
|
113
101
|
"""
|
|
114
102
|
Reduces tensors across all devices in such a way that all devices will get the same final result,
|
|
@@ -187,7 +175,6 @@ class AllReduce(Primitive):
|
|
|
187
175
|
if not isinstance(self.group, str):
|
|
188
176
|
raise TypeError(f"For '{self.name}', the 'group' must be str, "
|
|
189
177
|
f"but got {type(self.group).__name__}.")
|
|
190
|
-
check_hcom_group_valid(self.group, prim_name=self.name)
|
|
191
178
|
self.op = op
|
|
192
179
|
self.add_prim_attr('group', self.group)
|
|
193
180
|
self.add_prim_attr('fusion', 0)
|
|
@@ -300,7 +287,7 @@ class AllGather(PrimitiveWithInfer):
|
|
|
300
287
|
|
|
301
288
|
Outputs:
|
|
302
289
|
Tensor. If the number of devices in the group is N,
|
|
303
|
-
then the shape of output is :math:`(N
|
|
290
|
+
then the shape of output is :math:`(N*x_1, x_2, ..., x_R)`.
|
|
304
291
|
|
|
305
292
|
Raises:
|
|
306
293
|
TypeError: If `group` is not a str.
|
|
@@ -720,7 +707,6 @@ class Broadcast(PrimitiveWithInfer):
|
|
|
720
707
|
"""Initialize Broadcast."""
|
|
721
708
|
validator.check_value_type('root_rank', root_rank, (int,), self.name)
|
|
722
709
|
validator.check_value_type('group', _get_group(group), (str,), self.name)
|
|
723
|
-
check_hcom_group_valid(group, prim_name=self.name)
|
|
724
710
|
self.add_prim_attr('group', _get_group(group))
|
|
725
711
|
self.add_prim_attr('no_eliminate', True)
|
|
726
712
|
|
|
@@ -957,25 +943,8 @@ class AlltoAll(PrimitiveWithInfer):
|
|
|
957
943
|
self.concat_dim = concat_dim
|
|
958
944
|
self.add_prim_attr('group', _get_group(group))
|
|
959
945
|
self.add_prim_attr('no_eliminate', True)
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
rank_size = get_group_size(_get_group(self.group))
|
|
963
|
-
if self.split_count != rank_size:
|
|
964
|
-
raise ValueError(f"For '{self.name}', the 'split_count' must be equal to 'rank_size', "
|
|
965
|
-
f"but got 'split_count': {self.split_count}, 'rank_size': {rank_size}.")
|
|
966
|
-
if x_shape[self.split_dim] >= 0 and x_shape[self.split_dim] % self.split_count != 0:
|
|
967
|
-
raise ValueError(f"For '{self.name}', the 'x_shape[self.split_dim]' must be divisible by 'split_count', "
|
|
968
|
-
f"but got 'x_shape[self.split_dim]' {x_shape[self.split_dim]}, "
|
|
969
|
-
f"'split_count' {self.split_count}.")
|
|
970
|
-
if x_shape[self.concat_dim] >= 0:
|
|
971
|
-
x_shape[self.concat_dim] = x_shape[self.concat_dim] * self.split_count
|
|
972
|
-
if x_shape[self.split_dim] >= 0:
|
|
973
|
-
x_shape[self.split_dim] = int(x_shape[self.split_dim] / self.split_count)
|
|
974
|
-
return x_shape
|
|
975
|
-
|
|
976
|
-
def infer_dtype(self, x_dtype):
|
|
977
|
-
check_collective_target_dtype('x', x_dtype, self.name)
|
|
978
|
-
return x_dtype
|
|
946
|
+
self.rank_size = get_group_size(_get_group(group))
|
|
947
|
+
self.add_prim_attr('rank_size', self.rank_size)
|
|
979
948
|
|
|
980
949
|
|
|
981
950
|
class NeighborExchangeV2(Primitive):
|
|
@@ -1749,10 +1718,10 @@ class _VirtualAssignKvCache(PrimitiveWithInfer):
|
|
|
1749
1718
|
self.add_prim_attr('order_enforce_skip', True)
|
|
1750
1719
|
self.add_prim_attr('side_effect_backprop_mem', True)
|
|
1751
1720
|
|
|
1752
|
-
def infer_shape(self, x_shape, y_shape, kv_equal_shape):
|
|
1721
|
+
def infer_shape(self, x_shape, y_shape, kv_equal_shape=None):
|
|
1753
1722
|
return x_shape
|
|
1754
1723
|
|
|
1755
|
-
def infer_dtype(self, x_dtype, y_dtype, kv_equal_dtype):
|
|
1724
|
+
def infer_dtype(self, x_dtype, y_dtype, kv_equal_dtype=None):
|
|
1756
1725
|
return x_dtype
|
|
1757
1726
|
virtual_assign_kv_cache = _VirtualAssignKvCache()
|
|
1758
1727
|
|
|
@@ -1975,8 +1944,8 @@ class AlltoAllV(PrimitiveWithInfer):
|
|
|
1975
1944
|
AllToAllV which support uneven scatter and gather compared with AllToAll.
|
|
1976
1945
|
|
|
1977
1946
|
Note:
|
|
1978
|
-
|
|
1979
|
-
|
|
1947
|
+
Only support flatten tensor as input. input tensor should be flattened and
|
|
1948
|
+
concatenated before call this primitive.
|
|
1980
1949
|
|
|
1981
1950
|
Args:
|
|
1982
1951
|
group (str, optional): The communication group to work on. Default: ``GlobalComm.WORLD_COMM_GROUP``, which
|
|
@@ -2012,9 +1981,9 @@ class AlltoAllV(PrimitiveWithInfer):
|
|
|
2012
1981
|
|
|
2013
1982
|
This example should be run with 2 devices.
|
|
2014
1983
|
|
|
2015
|
-
>>> from mindspore import ops
|
|
2016
1984
|
>>> import mindspore.nn as nn
|
|
2017
1985
|
>>> from mindspore.communication import init, get_rank
|
|
1986
|
+
>>> from mindspore.ops import AlltoAllV
|
|
2018
1987
|
>>> from mindspore import Tensor
|
|
2019
1988
|
>>>
|
|
2020
1989
|
>>> init()
|
|
@@ -2022,7 +1991,7 @@ class AlltoAllV(PrimitiveWithInfer):
|
|
|
2022
1991
|
>>> class Net(nn.Cell):
|
|
2023
1992
|
... def __init__(self):
|
|
2024
1993
|
... super(Net, self).__init__()
|
|
2025
|
-
... self.all_to_all =
|
|
1994
|
+
... self.all_to_all = AlltoAllV()
|
|
2026
1995
|
...
|
|
2027
1996
|
... def construct(self, x, send_numel_list, recv_numel_list):
|
|
2028
1997
|
... return self.all_to_all(x, send_numel_list, recv_numel_list)
|
|
@@ -2053,3 +2022,179 @@ class AlltoAllV(PrimitiveWithInfer):
|
|
|
2053
2022
|
self.add_prim_attr('group', self.group)
|
|
2054
2023
|
validator.check_value_type("block_size", block_size, [int], self.name)
|
|
2055
2024
|
self.add_prim_attr('block_size', self.block_size)
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
class AllGatherV(PrimitiveWithInfer):
|
|
2028
|
+
"""
|
|
2029
|
+
Gathers uneven tensors from the specified communication group and returns the tensor which is all gathered.
|
|
2030
|
+
|
|
2031
|
+
Note:
|
|
2032
|
+
Only support flatten tensor as input. input tensor should be flattened and
|
|
2033
|
+
concatenated before call this primitive.
|
|
2034
|
+
|
|
2035
|
+
Args:
|
|
2036
|
+
group (str, optional): The communication group to work on. Default: ``GlobalComm.WORLD_COMM_GROUP`` , which
|
|
2037
|
+
means ``"hccl_world_group"`` in Ascend, and ``"nccl_world_group"`` in GPU.
|
|
2038
|
+
|
|
2039
|
+
Inputs:
|
|
2040
|
+
- **input_x** (Tensor) - One-dimensional tensor to be gathered, with the shape :math:`(x_1)`.
|
|
2041
|
+
- **output_split_sizes** (Union[tuple[int], list[int], Tensor]) - One-dimensional tensor, a list of the
|
|
2042
|
+
amount of data gathered by all ranks. The basic unit is the data type of Tensor.
|
|
2043
|
+
|
|
2044
|
+
Outputs:
|
|
2045
|
+
Tensor. flattened and concatenated tensor gather from remote ranks.
|
|
2046
|
+
If gather result is empty, it will return a Tensor with shape `()`, and value has no actual meaning.
|
|
2047
|
+
|
|
2048
|
+
Raises:
|
|
2049
|
+
RuntimeError: Device target is invalid, backend is invalid, or distributed initialization fails.
|
|
2050
|
+
|
|
2051
|
+
Supported Platforms:
|
|
2052
|
+
``Ascend`` ``GPU``
|
|
2053
|
+
|
|
2054
|
+
Examples:
|
|
2055
|
+
.. note::
|
|
2056
|
+
Before running the following examples, you need to configure the communication environment variables.
|
|
2057
|
+
|
|
2058
|
+
For Ascend/GPU/CPU devices, it is recommended to use the msrun startup method
|
|
2059
|
+
without any third-party or configuration file dependencies.
|
|
2060
|
+
Please see the `msrun start up
|
|
2061
|
+
<https://www.mindspore.cn/tutorials/en/master/parallel/msrun_launcher.html>`_
|
|
2062
|
+
for more details.
|
|
2063
|
+
|
|
2064
|
+
This example should be run with 2 devices.
|
|
2065
|
+
|
|
2066
|
+
>>> import mindspore as ms
|
|
2067
|
+
>>> from mindspore.ops import AllGatherV
|
|
2068
|
+
>>> import mindspore.nn as nn
|
|
2069
|
+
>>> from mindspore.communication import init, get_rank
|
|
2070
|
+
>>> from mindspore import Tensor
|
|
2071
|
+
>>>
|
|
2072
|
+
>>> ms.set_context(mode=ms.GRAPH_MODE)
|
|
2073
|
+
>>> init()
|
|
2074
|
+
>>> class Net(nn.Cell):
|
|
2075
|
+
... def __init__(self):
|
|
2076
|
+
... super(Net, self).__init__()
|
|
2077
|
+
... self.allgatherv = AllGatherV()
|
|
2078
|
+
...
|
|
2079
|
+
... def construct(self, x, output_split_sizes):
|
|
2080
|
+
... return self.allgatherv(x, output_split_sizes)
|
|
2081
|
+
...
|
|
2082
|
+
>>> rank = get_rank()
|
|
2083
|
+
>>> data = [i for i in range(rank + 3)]
|
|
2084
|
+
>>> input_x = Tensor(data)
|
|
2085
|
+
>>> output_split_sizes = [3, 4]
|
|
2086
|
+
>>> net = Net()
|
|
2087
|
+
>>> output = net(input_x, output_split_sizes)
|
|
2088
|
+
>>> print(output)
|
|
2089
|
+
[0 1 2 0 1 2 3]
|
|
2090
|
+
|
|
2091
|
+
Tutorial Examples:
|
|
2092
|
+
- `Distributed Set Communication Primitives - AllGatherV
|
|
2093
|
+
<https://www.mindspore.cn/docs/en/master/api_python/samples/ops/communicate_ops.html#allgatherv>`_
|
|
2094
|
+
|
|
2095
|
+
"""
|
|
2096
|
+
|
|
2097
|
+
@prim_attr_register
|
|
2098
|
+
def __init__(self, group=GlobalComm.WORLD_COMM_GROUP):
|
|
2099
|
+
"""Initialize AllGatherV."""
|
|
2100
|
+
self.group = _get_group(group)
|
|
2101
|
+
validator.check_value_type('group', self.group, (str,), self.name)
|
|
2102
|
+
self.rank = get_rank(self.group)
|
|
2103
|
+
self.rank_size = get_group_size(self.group)
|
|
2104
|
+
validator.check('rank', self.rank, 'rank_size', self.rank_size, validator.LT, self.name)
|
|
2105
|
+
self.add_prim_attr('rank_size', self.rank_size)
|
|
2106
|
+
self.add_prim_attr('group', self.group)
|
|
2107
|
+
self.add_prim_attr('mean_flag', False)
|
|
2108
|
+
self.rank_id = get_rank(_get_group(self.group))
|
|
2109
|
+
self.add_prim_attr('rank_id', self.rank_id)
|
|
2110
|
+
|
|
2111
|
+
|
|
2112
|
+
class ReduceScatterV(PrimitiveWithInfer):
|
|
2113
|
+
r"""
|
|
2114
|
+
Reduces and scatters uneven tensors from the specified communication group
|
|
2115
|
+
and returns the tensor which is reduced and scattered.
|
|
2116
|
+
|
|
2117
|
+
Note:
|
|
2118
|
+
Only support flatten tensor as input. The input tensor should be flattened and
|
|
2119
|
+
concatenated before call this primitive.
|
|
2120
|
+
|
|
2121
|
+
Args:
|
|
2122
|
+
op (str, optional): Specifies an operation used for element-wise reductions,
|
|
2123
|
+
like SUM, MIN and MAX, currently PROD is not supported. Default: ``ReduceOp.SUM`` .
|
|
2124
|
+
group (str, optional): The communication group to work on. Default: ``GlobalComm.WORLD_COMM_GROUP`` , which
|
|
2125
|
+
means ``"hccl_world_group"`` in Ascend, and ``"nccl_world_group"`` in GPU.
|
|
2126
|
+
|
|
2127
|
+
Inputs:
|
|
2128
|
+
- **input_x** (Tensor) - One-dimensional tensor to be distributed, with the shape :math:`(x_1)`.
|
|
2129
|
+
- **input_split_sizes** (Union[tuple[int], list[int], Tensor]) - One-dimensional tensor, a list of
|
|
2130
|
+
received data volumes for all ranks. The basic unit is the data type of Tensor. The value is not
|
|
2131
|
+
verified, and the user guarantees its correctness.
|
|
2132
|
+
|
|
2133
|
+
Outputs:
|
|
2134
|
+
Tensor. Reduces and scatters tensor from remote ranks.
|
|
2135
|
+
If the result is empty, it will return a Tensor with shape `()`, and value has no actual meaning.
|
|
2136
|
+
|
|
2137
|
+
Raises:
|
|
2138
|
+
RuntimeError: Device target is invalid, backend is invalid, or distributed initialization fails.
|
|
2139
|
+
|
|
2140
|
+
Supported Platforms:
|
|
2141
|
+
``Ascend`` ``GPU``
|
|
2142
|
+
|
|
2143
|
+
Examples:
|
|
2144
|
+
.. note::
|
|
2145
|
+
Before running the following examples, you need to configure the communication environment variables.
|
|
2146
|
+
|
|
2147
|
+
For Ascend/GPU/CPU devices, it is recommended to use the msrun startup method
|
|
2148
|
+
without any third-party or configuration file dependencies.
|
|
2149
|
+
Please see the `msrun start up
|
|
2150
|
+
<https://www.mindspore.cn/tutorials/en/master/parallel/msrun_launcher.html>`_
|
|
2151
|
+
for more details.
|
|
2152
|
+
|
|
2153
|
+
This example should be run with 2 devices.
|
|
2154
|
+
|
|
2155
|
+
>>> import mindspore as ms
|
|
2156
|
+
>>> from mindspore import Tensor
|
|
2157
|
+
>>> from mindspore.communication import init, get_rank
|
|
2158
|
+
>>> from mindspore.ops import ReduceOp
|
|
2159
|
+
>>> import mindspore.nn as nn
|
|
2160
|
+
>>> from mindspore.ops.operations.comm_ops import ReduceScatterV
|
|
2161
|
+
>>>
|
|
2162
|
+
>>> ms.set_context(mode=ms.GRAPH_MODE)
|
|
2163
|
+
>>> init()
|
|
2164
|
+
>>> class Net(nn.Cell):
|
|
2165
|
+
... def __init__(self):
|
|
2166
|
+
... super(Net, self).__init__()
|
|
2167
|
+
... self.reducescatterv = ReduceScatterV(ReduceOp.SUM)
|
|
2168
|
+
...
|
|
2169
|
+
... def construct(self, x, input_split_sizes):
|
|
2170
|
+
... return self.reducescatterv(x, input_split_sizes)
|
|
2171
|
+
...
|
|
2172
|
+
>>> rank = get_rank()
|
|
2173
|
+
>>> input_x = Tensor([0, 1, 2.0])
|
|
2174
|
+
>>> input_split_sizes = [2, 1]
|
|
2175
|
+
>>> net = Net()
|
|
2176
|
+
>>> output = net(input_x, input_split_sizes)
|
|
2177
|
+
>>> print(output)
|
|
2178
|
+
rank 0:
|
|
2179
|
+
[0. 2.]
|
|
2180
|
+
rank 1:
|
|
2181
|
+
[4.]
|
|
2182
|
+
|
|
2183
|
+
Tutorial Examples:
|
|
2184
|
+
- `Distributed Set Communication Primitives - ReduceScatterV
|
|
2185
|
+
<https://www.mindspore.cn/docs/en/master/api_python/samples/ops/communicate_ops.html#reducescatterv>`_
|
|
2186
|
+
|
|
2187
|
+
"""
|
|
2188
|
+
|
|
2189
|
+
@prim_attr_register
|
|
2190
|
+
def __init__(self, op=ReduceOp.SUM, group=GlobalComm.WORLD_COMM_GROUP):
|
|
2191
|
+
"""Initialize ReduceScatterV."""
|
|
2192
|
+
validator.check_value_type('op', op, (type(ReduceOp.SUM),), self.name)
|
|
2193
|
+
self.group = _get_group(group)
|
|
2194
|
+
validator.check_value_type('group', self.group, (str,), self.name)
|
|
2195
|
+
self.op = op
|
|
2196
|
+
self.rank_size = get_group_size(self.group)
|
|
2197
|
+
self.add_prim_attr('rank_size', self.rank_size)
|
|
2198
|
+
self.add_prim_attr('group', self.group)
|
|
2199
|
+
self.rank_id = get_rank(_get_group(self.group))
|
|
2200
|
+
self.add_prim_attr('rank_id', self.rank_id)
|