mindspore 2.6.0__cp311-cp311-win_amd64.whl → 2.7.0__cp311-cp311-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.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-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
|
@@ -1218,7 +1218,7 @@ def logical_not(input):
|
|
|
1218
1218
|
|
|
1219
1219
|
Examples:
|
|
1220
1220
|
>>> import mindspore
|
|
1221
|
-
>>> x = mindspore.tensor([True, False, True], mindspore.
|
|
1221
|
+
>>> x = mindspore.tensor([True, False, True], mindspore.bool)
|
|
1222
1222
|
>>> output = mindspore.ops.logical_not(x)
|
|
1223
1223
|
>>> print(output)
|
|
1224
1224
|
[False True False]
|
|
@@ -1250,23 +1250,23 @@ def logical_or(input, other):
|
|
|
1250
1250
|
|
|
1251
1251
|
Examples:
|
|
1252
1252
|
>>> import mindspore
|
|
1253
|
-
>>> x = mindspore.tensor([True, False, True], mindspore.
|
|
1254
|
-
>>> y = mindspore.tensor([True, True, False], mindspore.
|
|
1253
|
+
>>> x = mindspore.tensor([True, False, True], mindspore.bool)
|
|
1254
|
+
>>> y = mindspore.tensor([True, True, False], mindspore.bool)
|
|
1255
1255
|
>>> output = mindspore.ops.logical_or(x, y)
|
|
1256
1256
|
>>> print(output)
|
|
1257
1257
|
[ True True True]
|
|
1258
|
-
>>> x = mindspore.tensor(1, mindspore.
|
|
1259
|
-
>>> y = mindspore.tensor(0, mindspore.
|
|
1258
|
+
>>> x = mindspore.tensor(1, mindspore.bool)
|
|
1259
|
+
>>> y = mindspore.tensor(0, mindspore.bool)
|
|
1260
1260
|
>>> output = mindspore.ops.logical_or(x, y)
|
|
1261
1261
|
>>> print(output)
|
|
1262
1262
|
True
|
|
1263
1263
|
>>> x = True
|
|
1264
|
-
>>> y = mindspore.tensor(0, mindspore.
|
|
1264
|
+
>>> y = mindspore.tensor(0, mindspore.bool)
|
|
1265
1265
|
>>> output = mindspore.ops.logical_or(x, y)
|
|
1266
1266
|
>>> print(output)
|
|
1267
1267
|
True
|
|
1268
1268
|
>>> x = True
|
|
1269
|
-
>>> y = mindspore.tensor([True, False], mindspore.
|
|
1269
|
+
>>> y = mindspore.tensor([True, False], mindspore.bool)
|
|
1270
1270
|
>>> output = mindspore.ops.logical_or(x, y)
|
|
1271
1271
|
>>> print(output)
|
|
1272
1272
|
[True True]
|
|
@@ -1298,23 +1298,23 @@ def logical_and(input, other):
|
|
|
1298
1298
|
|
|
1299
1299
|
Examples:
|
|
1300
1300
|
>>> import mindspore
|
|
1301
|
-
>>> x = mindspore.tensor([True, False, True], mindspore.
|
|
1302
|
-
>>> y = mindspore.tensor([True, True, False], mindspore.
|
|
1301
|
+
>>> x = mindspore.tensor([True, False, True], mindspore.bool)
|
|
1302
|
+
>>> y = mindspore.tensor([True, True, False], mindspore.bool)
|
|
1303
1303
|
>>> output = mindspore.ops.logical_and(x, y)
|
|
1304
1304
|
>>> print(output)
|
|
1305
1305
|
[ True False False]
|
|
1306
|
-
>>> x = mindspore.tensor(1, mindspore.
|
|
1307
|
-
>>> y = mindspore.tensor(0, mindspore.
|
|
1306
|
+
>>> x = mindspore.tensor(1, mindspore.bool)
|
|
1307
|
+
>>> y = mindspore.tensor(0, mindspore.bool)
|
|
1308
1308
|
>>> output = mindspore.ops.logical_and(x, y)
|
|
1309
1309
|
>>> print(output)
|
|
1310
1310
|
False
|
|
1311
1311
|
>>> x = True
|
|
1312
|
-
>>> y = mindspore.tensor(0, mindspore.
|
|
1312
|
+
>>> y = mindspore.tensor(0, mindspore.bool)
|
|
1313
1313
|
>>> output = mindspore.ops.logical_and(x, y)
|
|
1314
1314
|
>>> print(output)
|
|
1315
1315
|
False
|
|
1316
1316
|
>>> x = True
|
|
1317
|
-
>>> y = mindspore.tensor([True, False], mindspore.
|
|
1317
|
+
>>> y = mindspore.tensor([True, False], mindspore.bool)
|
|
1318
1318
|
>>> output = mindspore.ops.logical_and(x, y)
|
|
1319
1319
|
>>> print(output)
|
|
1320
1320
|
[True False]
|
|
@@ -1782,10 +1782,10 @@ def pow_ext(input, exponent):
|
|
|
1782
1782
|
Args:
|
|
1783
1783
|
input (Union[Tensor, Number]): The first input is a Number or a tensor whose data type is
|
|
1784
1784
|
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
1785
|
-
`
|
|
1785
|
+
`bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
1786
1786
|
exponent (Union[Tensor, Number]): The second input is a Number or a tensor whose data type is
|
|
1787
1787
|
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
1788
|
-
`
|
|
1788
|
+
`bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
1789
1789
|
|
|
1790
1790
|
Returns:
|
|
1791
1791
|
Tensor, the shape is the same as the one after broadcasting,
|
|
@@ -3218,7 +3218,7 @@ def approximate_equal(x, y, tolerance=1e-5):
|
|
|
3218
3218
|
>>> import mindspore
|
|
3219
3219
|
>>> mindspore.ops.approximate_equal(mindspore.tensor([1e6, 2e6, float("inf"), float("-inf"), float("nan")]),
|
|
3220
3220
|
... mindspore.tensor([1e6, 2e7, float("inf"), float("-inf"), float("nan")]))
|
|
3221
|
-
Tensor(shape=[
|
|
3221
|
+
Tensor(shape=[5], dtype=Bool, value= [ True, False, False, False, False])
|
|
3222
3222
|
>>>
|
|
3223
3223
|
>>> mindspore.ops.approximate_equal(mindspore.tensor([1e6, 2e6, 3e6]),
|
|
3224
3224
|
... mindspore.tensor([1.00001e6, 2.00002e6, 3.00009e6]), tolerance=1e3)
|
|
@@ -5149,6 +5149,18 @@ def bernoulli_ext(input, *, generator=None):
|
|
|
5149
5149
|
return bernoulli_ext_(input, seed, offset)
|
|
5150
5150
|
|
|
5151
5151
|
|
|
5152
|
+
def bernoulli_(input, p=0.5, *, generator=None):
|
|
5153
|
+
r"""
|
|
5154
|
+
bernoulli_(input, p=0.5, *, generator=None) -> Tensor
|
|
5155
|
+
|
|
5156
|
+
In-place version of :func:`mindspore.ops.bernoulli_ext`.
|
|
5157
|
+
"""
|
|
5158
|
+
if generator is None:
|
|
5159
|
+
generator = default_generator
|
|
5160
|
+
seed, offset = generator._step(generator_step_) # pylint: disable=protected-access
|
|
5161
|
+
return ops.functional_overload.bernoulli_(input, p, seed, offset)
|
|
5162
|
+
|
|
5163
|
+
|
|
5152
5164
|
def bessel_i1(x):
|
|
5153
5165
|
r"""
|
|
5154
5166
|
Computes the first order modified Bessel function of the first kind for each element input.
|
|
@@ -5621,7 +5633,7 @@ def dstack(tensors):
|
|
|
5621
5633
|
1-D or 2-D tensors must have the same shape.
|
|
5622
5634
|
|
|
5623
5635
|
Args:
|
|
5624
|
-
tensors (Union(List[Tensor],
|
|
5636
|
+
tensors (Union(List[Tensor], tuple[Tensor])): The list of tensors or tuple of tensors.
|
|
5625
5637
|
|
|
5626
5638
|
Returns:
|
|
5627
5639
|
Tensor
|
|
@@ -5782,7 +5794,7 @@ def _diff_helper(input, n, dim):
|
|
|
5782
5794
|
is_bool = (input.dtype == mstype.bool_)
|
|
5783
5795
|
result = input
|
|
5784
5796
|
|
|
5785
|
-
for
|
|
5797
|
+
for _ in range(n): # pylint: disable=unused-variable
|
|
5786
5798
|
if is_bool:
|
|
5787
5799
|
result = logical_xor(narrow(result, dim, 1, out_len), narrow(result, dim, 0, out_len))
|
|
5788
5800
|
else:
|
|
@@ -6625,7 +6637,7 @@ def amin(input, axis=None, keepdims=False, *, initial=None, where=None):
|
|
|
6625
6637
|
>>> # case 4: Use "where" to include only specific elements in computing the minimum.
|
|
6626
6638
|
>>> where = mindspore.tensor([[1, 0, 1, 0],
|
|
6627
6639
|
... [0, 0, 1, 1],
|
|
6628
|
-
... [1, 1, 1, 0]], dtype=mindspore.
|
|
6640
|
+
... [1, 1, 1, 0]], dtype=mindspore.bool)
|
|
6629
6641
|
>>> mindspore.ops.amin(input, axis=1, keepdims=True, initial=0, where=where)
|
|
6630
6642
|
Tensor(shape=[3, 1], dtype=Int64, value=
|
|
6631
6643
|
[[ 0],
|
|
@@ -6707,7 +6719,7 @@ def amax(input, axis=None, keepdims=False, *, initial=None, where=None):
|
|
|
6707
6719
|
>>> # case 4: Use "where" to include only specific elements in computing the maximum.
|
|
6708
6720
|
>>> where = mindspore.tensor([[0, 0, 1, 0],
|
|
6709
6721
|
... [0, 0, 1, 1],
|
|
6710
|
-
... [1, 1, 1, 0]], dtype=mindspore.
|
|
6722
|
+
... [1, 1, 1, 0]], dtype=mindspore.bool)
|
|
6711
6723
|
>>> mindspore.ops.amax(input, axis=1, keepdims=True, initial=0, where=where)
|
|
6712
6724
|
Tensor(shape=[3, 1], dtype=Int64, value=
|
|
6713
6725
|
[[4],
|
|
@@ -9160,10 +9172,10 @@ def remainder_ext(input, other):
|
|
|
9160
9172
|
input (Union[Tensor, numbers.Number, bool]): The dividend is a numbers.Number or
|
|
9161
9173
|
a bool or a tensor whose data type is
|
|
9162
9174
|
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
9163
|
-
`
|
|
9175
|
+
`bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
9164
9176
|
other (Union[Tensor, numbers.Number, bool]): The divisor is a numbers.Number or
|
|
9165
|
-
a bool or a tensor whose data type is number or bool
|
|
9166
|
-
When the dividend is Scalar, the divisor must be a Tensor whose data type is number or bool
|
|
9177
|
+
a bool or a tensor whose data type is number or bool when the dividend is a tensor.
|
|
9178
|
+
When the dividend is Scalar, the divisor must be a Tensor whose data type is number or bool.
|
|
9167
9179
|
|
|
9168
9180
|
Returns:
|
|
9169
9181
|
Tensor, with dtype promoted and shape broadcasted.
|
|
@@ -9630,12 +9642,10 @@ def _einsum_convert_num_to_char(num):
|
|
|
9630
9642
|
"""For einsum, convert number into char."""
|
|
9631
9643
|
if [num] == [Ellipsis]:
|
|
9632
9644
|
return '...'
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
if num >= 26 and num < 52:
|
|
9638
|
-
return chr(num - 26 + ord('a'))
|
|
9645
|
+
if 0 <= num < 26:
|
|
9646
|
+
return chr(num + 65)
|
|
9647
|
+
if 26 <= num < 52:
|
|
9648
|
+
return chr(num + 71)
|
|
9639
9649
|
raise ValueError(f"For Einsum, the number in sublist should be in range [0, 52), but got {num}")
|
|
9640
9650
|
|
|
9641
9651
|
|
|
@@ -9737,33 +9747,19 @@ def einsum(equation, *operands):
|
|
|
9737
9747
|
return _get_cache_prim(P.Einsum)(equation)(operands)
|
|
9738
9748
|
|
|
9739
9749
|
|
|
9740
|
-
def
|
|
9741
|
-
"""Convert sublist to label."""
|
|
9742
|
-
if num == Ellipsis or ell_num and num == 52:
|
|
9743
|
-
return '...'
|
|
9744
|
-
if 0 <= num < 26:
|
|
9745
|
-
return chr(num + ord('A'))
|
|
9746
|
-
if 26 <= num < 52:
|
|
9747
|
-
return chr(num + ord('a') - 26)
|
|
9748
|
-
raise ValueError(
|
|
9749
|
-
f'For einsum, the number in sublist must be in range [0, 52), but got {num}')
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
def _einsum_convert_label_to_index(label):
|
|
9753
|
-
"""Convert label to index."""
|
|
9754
|
-
label_num = ord(label)
|
|
9755
|
-
if ord('A') <= label_num <= ord('Z'):
|
|
9756
|
-
return label_num - ord('A')
|
|
9757
|
-
if ord('a') <= label_num <= ord('z'):
|
|
9758
|
-
return label_num - ord('a') + 26
|
|
9759
|
-
if label_num == ord('.'):
|
|
9760
|
-
return 52
|
|
9761
|
-
raise ValueError(
|
|
9762
|
-
f'For einsum, the label in equation must be in [a-zA-Z] or ., but got {label}')
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
def _einsum_convert_sublist(equation, *operands):
|
|
9750
|
+
def _einsum_convert_sublist(equation, operands):
|
|
9766
9751
|
"""Convert the sublist to an equation operand if the received input is a sublist format."""
|
|
9752
|
+
def _einsum_convert_sublist_to_label(num, ell_num=False):
|
|
9753
|
+
"""Convert sublist to label."""
|
|
9754
|
+
if num == Ellipsis or ell_num and num == 52:
|
|
9755
|
+
return '...'
|
|
9756
|
+
if 0 <= num < 26:
|
|
9757
|
+
return chr(num + ord('A'))
|
|
9758
|
+
if 26 <= num < 52:
|
|
9759
|
+
return chr(num + ord('a') - 26)
|
|
9760
|
+
raise ValueError(
|
|
9761
|
+
f'For einsum, the number in sublist must be in range [0, 52), but got {num}')
|
|
9762
|
+
|
|
9767
9763
|
if isinstance(equation, Tensor):
|
|
9768
9764
|
equation_tmp = ''
|
|
9769
9765
|
for i, lst in enumerate(operands):
|
|
@@ -9788,331 +9784,6 @@ def _einsum_convert_sublist(equation, *operands):
|
|
|
9788
9784
|
return equation, operands
|
|
9789
9785
|
|
|
9790
9786
|
|
|
9791
|
-
def _einsum_check_inputargs(equation, operands):
|
|
9792
|
-
"""Check equation and operands."""
|
|
9793
|
-
if not isinstance(equation, str):
|
|
9794
|
-
raise TypeError(
|
|
9795
|
-
f"For einsum, 'equation' must be a str, but got {type(equation)}.")
|
|
9796
|
-
for operand in operands:
|
|
9797
|
-
if not isinstance(operand, Tensor):
|
|
9798
|
-
raise TypeError(
|
|
9799
|
-
f"For einsum, members of 'operands' must be Tensor, but got {type(operand)}.")
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
@constexpr
|
|
9803
|
-
def _einsum_parse_equation(equation):
|
|
9804
|
-
"""Parse equation."""
|
|
9805
|
-
l_equation = ''
|
|
9806
|
-
r_equation = ''
|
|
9807
|
-
equation = equation.replace(' ', '')
|
|
9808
|
-
|
|
9809
|
-
if '->' in equation:
|
|
9810
|
-
l_equation, r_equation = equation.split('->', 1)
|
|
9811
|
-
if l_equation == '':
|
|
9812
|
-
raise ValueError(
|
|
9813
|
-
'For einsum, equation must contain characters to the left fo the arrow.')
|
|
9814
|
-
else:
|
|
9815
|
-
l_equation = equation
|
|
9816
|
-
|
|
9817
|
-
if ',' in l_equation:
|
|
9818
|
-
l_equationlst = l_equation.split(",")
|
|
9819
|
-
else:
|
|
9820
|
-
l_equationlst = [l_equation]
|
|
9821
|
-
|
|
9822
|
-
l_equationlst = []
|
|
9823
|
-
|
|
9824
|
-
for subequation in l_equation.split(','):
|
|
9825
|
-
if '.' in subequation and ('...' not in subequation or subequation.count('.') != 3):
|
|
9826
|
-
raise ValueError(f"For einsum, an ellipsis in the equation must include three continuous \'.\', "
|
|
9827
|
-
f"and can only be found once.")
|
|
9828
|
-
subequation_lst = [_einsum_convert_label_to_index(label) for label in subequation.replace('...', '.')]
|
|
9829
|
-
l_equationlst.append(subequation_lst)
|
|
9830
|
-
|
|
9831
|
-
if "." in r_equation and ('...' not in r_equation or r_equation.count('.') != 3):
|
|
9832
|
-
raise ValueError(f"For einsum, an ellipsis in the equation must include three continuous \'.\', "
|
|
9833
|
-
f"and can only be found once.")
|
|
9834
|
-
r_equationlst = [_einsum_convert_label_to_index(label) for label in r_equation.replace('...', '.')]
|
|
9835
|
-
|
|
9836
|
-
return l_equationlst, r_equationlst, ('->' in equation)
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
def _einsum_parse_labels(l_equationlst, operands):
|
|
9840
|
-
"""Parse left script of equation."""
|
|
9841
|
-
align_rank = 0
|
|
9842
|
-
max_labels = 53
|
|
9843
|
-
ellipsis_dimnum = 0
|
|
9844
|
-
labels_count = [0] * max_labels
|
|
9845
|
-
|
|
9846
|
-
if len(operands) != len(l_equationlst):
|
|
9847
|
-
raise ValueError(f"For einsum, 'operands' is not equal to specified in the 'equation', "
|
|
9848
|
-
f"but got {len(operands)} and {len(l_equationlst)}.")
|
|
9849
|
-
|
|
9850
|
-
for idx, sub_equ in enumerate(l_equationlst):
|
|
9851
|
-
start_dim = 0
|
|
9852
|
-
label_num = 0
|
|
9853
|
-
operand_shape = list(operands[idx].shape)
|
|
9854
|
-
for label in sub_equ:
|
|
9855
|
-
dim_num = 1
|
|
9856
|
-
label_num += 1
|
|
9857
|
-
end_dim = start_dim + 1
|
|
9858
|
-
|
|
9859
|
-
# Label is ellipsis
|
|
9860
|
-
if label == 52:
|
|
9861
|
-
end_dim = len(operand_shape) - len(sub_equ) + label_num
|
|
9862
|
-
dim_num = end_dim - start_dim
|
|
9863
|
-
if ellipsis_dimnum != 0 and ellipsis_dimnum != dim_num:
|
|
9864
|
-
raise ValueError(f"For einsum, an ellipsis in 'equation' can only represent the same numbers of "
|
|
9865
|
-
f"dimensions in 'operands'.")
|
|
9866
|
-
ellipsis_dimnum = dim_num
|
|
9867
|
-
if labels_count[label] == 0:
|
|
9868
|
-
align_rank += dim_num
|
|
9869
|
-
labels_count[label] += 1
|
|
9870
|
-
start_dim += dim_num
|
|
9871
|
-
if label_num != len(sub_equ) or start_dim != len(operand_shape):
|
|
9872
|
-
raise ValueError(f"For einsum, the numbers of labels specified in the 'equation' does not match "
|
|
9873
|
-
f"'operands[{idx}]'.")
|
|
9874
|
-
return ellipsis_dimnum, labels_count, align_rank
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
def _einsum_infer_output(r_equationlst, arrow_exist, ellipsis_dimnum, labels_count):
|
|
9878
|
-
"""Parse right script of equation and infer output shape."""
|
|
9879
|
-
idx = 0
|
|
9880
|
-
idle_idx = -1
|
|
9881
|
-
output_rank = 0
|
|
9882
|
-
labels_perm_idx = [idle_idx] * 53
|
|
9883
|
-
|
|
9884
|
-
if arrow_exist:
|
|
9885
|
-
for label in r_equationlst:
|
|
9886
|
-
if labels_count[label] != 0:
|
|
9887
|
-
if labels_perm_idx[label] != idle_idx:
|
|
9888
|
-
raise ValueError(f"For einsum, '{_einsum_convert_sublist_to_label(label, True)}' or {label} in "
|
|
9889
|
-
f"sublist format has appears more than once in output subscript.")
|
|
9890
|
-
dimnum = 1
|
|
9891
|
-
if label == 52:
|
|
9892
|
-
dimnum = ellipsis_dimnum
|
|
9893
|
-
labels_perm_idx[label] = idx
|
|
9894
|
-
output_rank += dimnum
|
|
9895
|
-
idx += dimnum
|
|
9896
|
-
else:
|
|
9897
|
-
raise ValueError(f"For einsum, the label to the right of arrow in the 'equation' must appear on "
|
|
9898
|
-
f"left, but '{_einsum_convert_sublist_to_label(label, True)}' does not.")
|
|
9899
|
-
else:
|
|
9900
|
-
if labels_count[52] != 0:
|
|
9901
|
-
output_rank += ellipsis_dimnum
|
|
9902
|
-
labels_perm_idx[52] = idx
|
|
9903
|
-
idx += ellipsis_dimnum
|
|
9904
|
-
for label, count in enumerate(labels_count):
|
|
9905
|
-
if count == 1:
|
|
9906
|
-
output_rank += 1
|
|
9907
|
-
labels_perm_idx[label] = idx
|
|
9908
|
-
idx += 1
|
|
9909
|
-
|
|
9910
|
-
for label, count in enumerate(labels_count):
|
|
9911
|
-
if count != 0 and labels_perm_idx[label] == idle_idx:
|
|
9912
|
-
labels_perm_idx[label] = idx
|
|
9913
|
-
idx += 1
|
|
9914
|
-
|
|
9915
|
-
return output_rank, labels_perm_idx
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
def _einsum_adjust_operands(operands, l_equationlst, ellipsis_dimnum, labels_perm_idx, align_rank):
|
|
9919
|
-
"""Align operands to output as possible."""
|
|
9920
|
-
# Unsqueeze miss dimensions to make all operands has same rank, compute diagonal if operand has same label.
|
|
9921
|
-
# Then use _labels_perm_idx to transpose all operands to align dimensions with output.
|
|
9922
|
-
adjust_operands = []
|
|
9923
|
-
for idx, operand in enumerate(operands):
|
|
9924
|
-
idle_dim = -1
|
|
9925
|
-
align_axis = [idle_dim] * align_rank
|
|
9926
|
-
label_dims = [idle_dim] * 53
|
|
9927
|
-
dim = 0
|
|
9928
|
-
|
|
9929
|
-
for label in l_equationlst[idx]:
|
|
9930
|
-
if label_dims[label] != idle_dim:
|
|
9931
|
-
operand = ops.diagonal(operand, 0, label_dims[label], dim)
|
|
9932
|
-
diag_perm = []
|
|
9933
|
-
diag_dim = 0
|
|
9934
|
-
for i in range(len(operand.shape)):
|
|
9935
|
-
if i == label_dims[label]:
|
|
9936
|
-
diag_perm.append(len(operand.shape) - 1)
|
|
9937
|
-
else:
|
|
9938
|
-
diag_perm.append(diag_dim)
|
|
9939
|
-
diag_dim += 1
|
|
9940
|
-
operand = permute(operand, tuple(diag_perm))
|
|
9941
|
-
else:
|
|
9942
|
-
label_dims[label] = dim
|
|
9943
|
-
if label == 52:
|
|
9944
|
-
for ell_idx in range(ellipsis_dimnum):
|
|
9945
|
-
align_axis[labels_perm_idx[label] + ell_idx] = dim
|
|
9946
|
-
dim += 1
|
|
9947
|
-
else:
|
|
9948
|
-
align_axis[labels_perm_idx[label]] = dim
|
|
9949
|
-
dim += 1
|
|
9950
|
-
if len(operand.shape) < align_rank:
|
|
9951
|
-
for i, axis in enumerate(align_axis):
|
|
9952
|
-
if axis == idle_dim:
|
|
9953
|
-
align_axis[i] = dim
|
|
9954
|
-
dim += 1
|
|
9955
|
-
missing_dims = [1] * (align_rank - len(operand.shape))
|
|
9956
|
-
operand_shape = list(operand.shape) + missing_dims
|
|
9957
|
-
operand = ops.reshape(operand, operand_shape)
|
|
9958
|
-
operand = permute(operand, tuple(align_axis))
|
|
9959
|
-
adjust_operands.append(operand)
|
|
9960
|
-
return adjust_operands
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
def _einsum_find_dimlastop(align_rank, operands, adjust_operands):
|
|
9964
|
-
"""Find dim last operand."""
|
|
9965
|
-
dim_last_op = [0] * align_rank
|
|
9966
|
-
has_zero_dim = False
|
|
9967
|
-
for dim in range(align_rank):
|
|
9968
|
-
broadcast_dim = adjust_operands[0].shape[dim]
|
|
9969
|
-
for idx in range(1, len(adjust_operands)):
|
|
9970
|
-
other_dim = adjust_operands[idx].shape[dim]
|
|
9971
|
-
if broadcast_dim != other_dim and broadcast_dim != 1 and other_dim != 1:
|
|
9972
|
-
err_msg = "For einsum, operands do not broadcast after align to output [shapes :origin -> adjust]:"
|
|
9973
|
-
for i in range(len(operands)):
|
|
9974
|
-
err_msg += f" {operands[i].shape} -> {adjust_operands[i].shape}"
|
|
9975
|
-
raise ValueError(err_msg)
|
|
9976
|
-
if other_dim != 1:
|
|
9977
|
-
dim_last_op[dim] = idx
|
|
9978
|
-
broadcast_dim = other_dim
|
|
9979
|
-
has_zero_dim = has_zero_dim or broadcast_dim == 0
|
|
9980
|
-
return dim_last_op, has_zero_dim
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
def _einsum_multiplication(sum_dims, l_tensor, r_tensor):
|
|
9984
|
-
"""Compute bmm for einsum."""
|
|
9985
|
-
batch_dims = []
|
|
9986
|
-
lonly_dims = []
|
|
9987
|
-
ronly_dims = []
|
|
9988
|
-
batch_size = 1
|
|
9989
|
-
lonly_size = 1
|
|
9990
|
-
ronly_size = 1
|
|
9991
|
-
sum_size = 1
|
|
9992
|
-
|
|
9993
|
-
l_shape = l_tensor.shape
|
|
9994
|
-
r_shape = r_tensor.shape
|
|
9995
|
-
|
|
9996
|
-
# Compute sum if dim is in sum_dims and get shapes for bmm
|
|
9997
|
-
for i in range(len(l_shape)):
|
|
9998
|
-
sum_l = l_shape[i] > 1
|
|
9999
|
-
sum_r = r_shape[i] > 1
|
|
10000
|
-
if i in sum_dims:
|
|
10001
|
-
if sum_l and sum_r:
|
|
10002
|
-
sum_size *= l_shape[i]
|
|
10003
|
-
elif sum_l:
|
|
10004
|
-
l_tensor = ops.auto_generate.sum_ext(l_tensor, i, True)
|
|
10005
|
-
elif sum_r:
|
|
10006
|
-
r_tensor = ops.auto_generate.sum_ext(r_tensor, i, True)
|
|
10007
|
-
elif sum_l and sum_r:
|
|
10008
|
-
batch_dims.append(i)
|
|
10009
|
-
batch_size *= l_shape[i]
|
|
10010
|
-
elif sum_l:
|
|
10011
|
-
lonly_dims.append(i)
|
|
10012
|
-
lonly_size *= l_shape[i]
|
|
10013
|
-
else:
|
|
10014
|
-
ronly_dims.append(i)
|
|
10015
|
-
ronly_size *= r_shape[i]
|
|
10016
|
-
|
|
10017
|
-
# Compute the einsum bmm operators pipeline.
|
|
10018
|
-
# The whole operators pipeline is transpose(in) -> reshape(in) -> bmm(in) -> reshape(out) -> transpose(out).
|
|
10019
|
-
l_reshape_shape = (batch_size, lonly_size, sum_size)
|
|
10020
|
-
r_reshape_shape = (batch_size, sum_size, ronly_size)
|
|
10021
|
-
|
|
10022
|
-
out_reshape_shape = [l_shape[dim] for dim in batch_dims]
|
|
10023
|
-
out_reshape_shape += [l_shape[dim] for dim in lonly_dims]
|
|
10024
|
-
out_reshape_shape += [1 for _ in sum_dims]
|
|
10025
|
-
out_reshape_shape += [r_shape[dim] for dim in ronly_dims]
|
|
10026
|
-
|
|
10027
|
-
l_perm_axis = batch_dims + lonly_dims + sum_dims + ronly_dims
|
|
10028
|
-
r_perm_axis = batch_dims + sum_dims + ronly_dims + lonly_dims
|
|
10029
|
-
out_perm_axis = [-1] * len(out_reshape_shape)
|
|
10030
|
-
|
|
10031
|
-
out_dim = 0
|
|
10032
|
-
for idx in range(len(l_perm_axis)):
|
|
10033
|
-
out_perm_axis[l_perm_axis[idx]] = out_dim
|
|
10034
|
-
out_dim += 1
|
|
10035
|
-
|
|
10036
|
-
l_tensor = permute(l_tensor, tuple(l_perm_axis))
|
|
10037
|
-
l_tensor = ops.reshape(l_tensor, l_reshape_shape)
|
|
10038
|
-
|
|
10039
|
-
r_tensor = permute(r_tensor, tuple(r_perm_axis))
|
|
10040
|
-
r_tensor = ops.reshape(r_tensor, r_reshape_shape)
|
|
10041
|
-
|
|
10042
|
-
output = bmm_ext(l_tensor, r_tensor)
|
|
10043
|
-
output = ops.reshape(output, out_reshape_shape)
|
|
10044
|
-
output = permute(output, tuple(out_perm_axis))
|
|
10045
|
-
|
|
10046
|
-
output_origin_shape = output.shape
|
|
10047
|
-
output_squeeze_shape = []
|
|
10048
|
-
for dim in range(len(output_origin_shape)):
|
|
10049
|
-
if dim not in sum_dims:
|
|
10050
|
-
output_squeeze_shape.append(output_origin_shape[dim])
|
|
10051
|
-
|
|
10052
|
-
return ops.reshape(output, output_squeeze_shape)
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
def _einsum(equation, operands):
|
|
10056
|
-
'''Einsum main process'''
|
|
10057
|
-
_l_equationlst, _r_equationlst, _arrow_exist = _einsum_parse_equation(
|
|
10058
|
-
equation)
|
|
10059
|
-
_ellipsis_dimnum, _labels_count, _align_rank = _einsum_parse_labels(
|
|
10060
|
-
_l_equationlst, operands)
|
|
10061
|
-
_output_rank, _labels_perm_idx = _einsum_infer_output(
|
|
10062
|
-
_r_equationlst, _arrow_exist, _ellipsis_dimnum, _labels_count)
|
|
10063
|
-
_adjust_operands = _einsum_adjust_operands(operands, _l_equationlst, _ellipsis_dimnum, _labels_perm_idx,
|
|
10064
|
-
_align_rank)
|
|
10065
|
-
_dim_last_op, _has_zero_dim = _einsum_find_dimlastop(
|
|
10066
|
-
_align_rank, operands, _adjust_operands)
|
|
10067
|
-
_result = _adjust_operands[0]
|
|
10068
|
-
|
|
10069
|
-
# Fast path if operands has zero dim.
|
|
10070
|
-
if _has_zero_dim:
|
|
10071
|
-
output_shape = []
|
|
10072
|
-
for dim in range(_output_rank):
|
|
10073
|
-
output_shape.append(_adjust_operands[_dim_last_op[dim]].shape[dim])
|
|
10074
|
-
return ops.auto_generate.zeros(output_shape, dtype=_result.dtype)
|
|
10075
|
-
|
|
10076
|
-
# Sum or squeeze dimensions that is 1 for all rest operands.
|
|
10077
|
-
_reduce_dim = _output_rank
|
|
10078
|
-
for dim in range(_output_rank, _align_rank):
|
|
10079
|
-
if _dim_last_op[dim] == 0:
|
|
10080
|
-
if _result.shape[_reduce_dim] == 1:
|
|
10081
|
-
_result = ops.auto_generate.pyboost_inner_prim.squeeze_impl(_result, _reduce_dim)
|
|
10082
|
-
else:
|
|
10083
|
-
_result = ops.auto_generate.sum_ext(_result, _reduce_dim)
|
|
10084
|
-
else:
|
|
10085
|
-
_reduce_dim += 1
|
|
10086
|
-
|
|
10087
|
-
# Compute multiplication if operands are more than two.
|
|
10088
|
-
for i in range(1, len(_adjust_operands)):
|
|
10089
|
-
operand = _adjust_operands[i]
|
|
10090
|
-
dim = _output_rank
|
|
10091
|
-
sum_dims = []
|
|
10092
|
-
for j in range(_output_rank, _align_rank):
|
|
10093
|
-
if _dim_last_op[j] < i:
|
|
10094
|
-
operand = ops.auto_generate.pyboost_inner_prim.squeeze_impl(operand, dim)
|
|
10095
|
-
elif _dim_last_op[j] == i:
|
|
10096
|
-
if _result.shape[dim] == 1:
|
|
10097
|
-
operand = ops.auto_generate.sum_ext(operand, dim)
|
|
10098
|
-
_result = ops.auto_generate.pyboost_inner_prim.squeeze_impl(_result, dim)
|
|
10099
|
-
else:
|
|
10100
|
-
sum_dims.append(dim)
|
|
10101
|
-
dim += 1
|
|
10102
|
-
else:
|
|
10103
|
-
dim += 1
|
|
10104
|
-
|
|
10105
|
-
if sum_dims == []:
|
|
10106
|
-
_result = mul_ext(_result, operand)
|
|
10107
|
-
elif len(sum_dims) == len(_result.shape):
|
|
10108
|
-
_result = ops.auto_generate.dot(ops.auto_generate.flatten_ext(_result),
|
|
10109
|
-
ops.auto_generate.flatten_ext(operand))
|
|
10110
|
-
else:
|
|
10111
|
-
_result = _einsum_multiplication(sum_dims, _result, operand)
|
|
10112
|
-
|
|
10113
|
-
return _result
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
9787
|
def einsum_ext(equation, *operands):
|
|
10117
9788
|
r"""
|
|
10118
9789
|
According to the Einstein summation Convention (Einsum),
|
|
@@ -10207,14 +9878,9 @@ def einsum_ext(equation, *operands):
|
|
|
10207
9878
|
[3. 6.]
|
|
10208
9879
|
[4. 8.]]
|
|
10209
9880
|
"""
|
|
10210
|
-
_equation, _operands = _einsum_convert_sublist(equation,
|
|
10211
|
-
_einsum_check_inputargs(_equation, _operands)
|
|
10212
|
-
|
|
10213
|
-
for operand in _operands:
|
|
10214
|
-
if ops.is_sequence_shape_unknown(operand.shape) or ops.is_sequence_value_unknown(operand.shape):
|
|
10215
|
-
raise ValueError(f"For einsum, the element of 'operands' can't be dynamic shape or dynamic rank.")
|
|
9881
|
+
_equation, _operands = _einsum_convert_sublist(equation, operands)
|
|
10216
9882
|
|
|
10217
|
-
return
|
|
9883
|
+
return ops.functional_overload.einsum(_equation, _operands)
|
|
10218
9884
|
|
|
10219
9885
|
|
|
10220
9886
|
def cumprod(input, dim, dtype=None):
|
|
@@ -10523,23 +10189,23 @@ def logical_xor(input, other):
|
|
|
10523
10189
|
|
|
10524
10190
|
Examples:
|
|
10525
10191
|
>>> import mindspore
|
|
10526
|
-
>>> x = mindspore.tensor([True, False, True], mindspore.
|
|
10527
|
-
>>> y = mindspore.tensor([True, True, False], mindspore.
|
|
10192
|
+
>>> x = mindspore.tensor([True, False, True], mindspore.bool)
|
|
10193
|
+
>>> y = mindspore.tensor([True, True, False], mindspore.bool)
|
|
10528
10194
|
>>> output = mindspore.ops.logical_xor(x, y)
|
|
10529
10195
|
>>> print(output)
|
|
10530
10196
|
[False True True]
|
|
10531
|
-
>>> x = mindspore.tensor(1, mindspore.
|
|
10532
|
-
>>> y = mindspore.tensor(0, mindspore.
|
|
10197
|
+
>>> x = mindspore.tensor(1, mindspore.bool)
|
|
10198
|
+
>>> y = mindspore.tensor(0, mindspore.bool)
|
|
10533
10199
|
>>> output = mindspore.ops.logical_xor(x, y)
|
|
10534
10200
|
>>> print(output)
|
|
10535
10201
|
True
|
|
10536
10202
|
>>> x = True
|
|
10537
|
-
>>> y = mindspore.tensor(0, mindspore.
|
|
10203
|
+
>>> y = mindspore.tensor(0, mindspore.bool)
|
|
10538
10204
|
>>> output = mindspore.ops.logical_xor(x, y)
|
|
10539
10205
|
>>> print(output)
|
|
10540
10206
|
True
|
|
10541
10207
|
>>> x = True
|
|
10542
|
-
>>> y = mindspore.tensor([True, False], mindspore.
|
|
10208
|
+
>>> y = mindspore.tensor([True, False], mindspore.bool)
|
|
10543
10209
|
>>> output = mindspore.ops.logical_xor(x, y)
|
|
10544
10210
|
>>> print(output)
|
|
10545
10211
|
[False True]
|
|
@@ -10998,7 +10664,7 @@ def _canonicalize_fft_shape_and_dim(input, shape, dim):
|
|
|
10998
10664
|
|
|
10999
10665
|
|
|
11000
10666
|
def as_strided(x, shape=None, strides=None):
|
|
11001
|
-
n = np.dtype(mstype.
|
|
10667
|
+
n = np.dtype(mstype._dtype_to_nptype(x.dtype)).itemsize # pylint:disable=protected-access
|
|
11002
10668
|
strides = tuple(np.array(strides) * n)
|
|
11003
10669
|
if x.dtype == mstype.bfloat16:
|
|
11004
10670
|
return Tensor(np.lib.stride_tricks.as_strided(x.float().asnumpy(), shape, strides, False, True), dtype=x.dtype)
|
|
@@ -11049,7 +10715,7 @@ def _permute_input(input, input_dim, ret_dim):
|
|
|
11049
10715
|
(dim_permute_a if not is_transformed_dim[i] else dim_permute_b).append(value)
|
|
11050
10716
|
|
|
11051
10717
|
# strides
|
|
11052
|
-
type_size = np.dtype(mstype.
|
|
10718
|
+
type_size = np.dtype(mstype._dtype_to_nptype(input.dtype)).itemsize # pylint:disable=protected-access
|
|
11053
10719
|
input_strides = [int(x / type_size) for x in input.strides]
|
|
11054
10720
|
|
|
11055
10721
|
def cmp(x, y):
|
|
@@ -11162,7 +10828,7 @@ def _handle_fftwithsize_output(out, input_dim, batch_dims, dim_permute, out_size
|
|
|
11162
10828
|
for i in range(batch_dims, input_dim):
|
|
11163
10829
|
out_strides[dim_permute[i]] = out.strides[1 + (i - batch_dims)]
|
|
11164
10830
|
|
|
11165
|
-
type_size = np.dtype(mstype.
|
|
10831
|
+
type_size = np.dtype(mstype._dtype_to_nptype(out.dtype)).itemsize # pylint:disable=protected-access
|
|
11166
10832
|
if out.shape != out_sizes or out.strides != out_strides:
|
|
11167
10833
|
out = as_strided(out, out_sizes, [int(i / type_size) for i in out_strides])
|
|
11168
10834
|
return out
|
|
@@ -11540,7 +11206,7 @@ def count_nonzero(x, axis=(), keep_dims=False, dtype=mstype.int32):
|
|
|
11540
11206
|
Default ``()`` , which counts all non-zero elements.
|
|
11541
11207
|
keep_dims (bool, optional): Whether to maintain dimensions specified by `axis`.
|
|
11542
11208
|
Default ``False`` , don't keep these dimensions.
|
|
11543
|
-
dtype (Union[Number, mindspore.bool
|
|
11209
|
+
dtype (Union[Number, mindspore.bool], optional): The data type returned.
|
|
11544
11210
|
Default ``mstype.int32`` .
|
|
11545
11211
|
|
|
11546
11212
|
|
|
@@ -12429,11 +12095,11 @@ def mul_ext(input, other):
|
|
|
12429
12095
|
input (Union[Tensor, number.Number, bool]): The first input is a number.Number or
|
|
12430
12096
|
a bool or a tensor whose data type is
|
|
12431
12097
|
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
12432
|
-
`
|
|
12098
|
+
`bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
12433
12099
|
other (Union[Tensor, number.Number, bool]): The second input, is a number.Number or
|
|
12434
12100
|
a bool or a tensor whose data type is
|
|
12435
12101
|
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
12436
|
-
`
|
|
12102
|
+
`bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
12437
12103
|
|
|
12438
12104
|
Returns:
|
|
12439
12105
|
Tensor, the shape is the same as the one after broadcasting,
|