mindspore 2.7.0rc1__cp311-cp311-win_amd64.whl → 2.7.1__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/__init__.py +5 -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 +2 -2
- mindspore/_extends/builtin_operations.py +3 -3
- 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 +24 -1
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +6 -3
- mindspore/_extends/parse/parser.py +28 -22
- mindspore/_extends/parse/resources.py +1 -1
- mindspore/_extends/parse/standard_method.py +23 -2
- mindspore/_extends/parse/trope.py +2 -1
- mindspore/_extends/pijit/pijit_func_white_list.py +9 -27
- mindspore/amp.py +0 -18
- 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/base.py +29 -2
- mindspore/common/__init__.py +18 -12
- mindspore/common/_decorator.py +3 -2
- mindspore/common/_grad_function.py +3 -1
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +371 -96
- mindspore/common/_utils.py +7 -43
- mindspore/common/api.py +434 -135
- mindspore/common/dtype.py +98 -57
- mindspore/common/dump.py +7 -108
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +15 -23
- mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
- mindspore/common/file_system.py +59 -9
- mindspore/common/hook_handle.py +82 -3
- mindspore/common/jit_config.py +5 -1
- mindspore/common/jit_trace.py +27 -12
- mindspore/common/lazy_inline.py +5 -3
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +17 -127
- mindspore/common/recompute.py +4 -13
- mindspore/common/tensor.py +50 -217
- mindspore/communication/_comm_helper.py +11 -1
- mindspore/communication/comm_func.py +138 -4
- mindspore/communication/management.py +85 -1
- mindspore/config/op_info.config +0 -15
- mindspore/context.py +20 -106
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +35 -1
- mindspore/dataset/engine/datasets.py +338 -319
- mindspore/dataset/engine/datasets_user_defined.py +38 -22
- mindspore/dataset/engine/datasets_vision.py +1 -1
- mindspore/dataset/engine/validators.py +1 -15
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/transforms.py +3 -3
- 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/device_context/ascend/op_tuning.py +35 -1
- mindspore/dnnl.dll +0 -0
- mindspore/{profiler/common/validator → graph}/__init__.py +9 -1
- mindspore/graph/custom_pass.py +55 -0
- mindspore/include/api/cell.h +28 -4
- mindspore/include/api/cfg.h +24 -7
- mindspore/include/api/context.h +1 -0
- mindspore/include/api/delegate.h +0 -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 +5 -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 +6 -1
- mindspore/include/dataset/constants.h +9 -0
- mindspore/include/dataset/execute.h +2 -2
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/__init__.py +3 -3
- mindspore/mindrecord/common/exceptions.py +1 -0
- mindspore/mindrecord/config.py +1 -1
- mindspore/{parallel/mpi → mindrecord/core}/__init__.py +4 -1
- mindspore/mindrecord/{shardheader.py → core/shardheader.py} +2 -1
- mindspore/mindrecord/{shardindexgenerator.py → core/shardindexgenerator.py} +1 -1
- mindspore/mindrecord/{shardreader.py → core/shardreader.py} +2 -1
- mindspore/mindrecord/{shardsegment.py → core/shardsegment.py} +2 -2
- mindspore/mindrecord/{shardutils.py → core/shardutils.py} +1 -1
- mindspore/mindrecord/{shardwriter.py → core/shardwriter.py} +1 -1
- mindspore/mindrecord/filereader.py +4 -4
- mindspore/mindrecord/filewriter.py +5 -5
- mindspore/mindrecord/mindpage.py +2 -2
- mindspore/mindrecord/tools/cifar10.py +4 -3
- mindspore/mindrecord/tools/cifar100.py +1 -1
- mindspore/mindrecord/tools/cifar100_to_mr.py +1 -1
- mindspore/mindrecord/tools/cifar10_to_mr.py +6 -6
- mindspore/mindrecord/tools/csv_to_mr.py +1 -1
- mindspore/mindrecord/tools/imagenet_to_mr.py +1 -1
- mindspore/mindrecord/tools/mnist_to_mr.py +1 -1
- mindspore/mindrecord/tools/tfrecord_to_mr.py +1 -1
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_cluster.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_hardware_abstract.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 → mindspore_ops_cpu.dll} +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mindspore_runtime_utils.dll +0 -0
- mindspore/mindspore_tools.dll +0 -0
- mindspore/mint/__init__.py +15 -10
- mindspore/mint/distributed/__init__.py +4 -0
- mindspore/mint/distributed/distributed.py +392 -69
- mindspore/mint/nn/__init__.py +2 -16
- mindspore/mint/nn/functional.py +4 -110
- mindspore/mint/nn/layer/__init__.py +0 -2
- mindspore/mint/nn/layer/_functions.py +1 -2
- mindspore/mint/nn/layer/activation.py +0 -6
- mindspore/mint/nn/layer/basic.py +0 -47
- mindspore/mint/nn/layer/conv.py +10 -10
- mindspore/mint/nn/layer/normalization.py +11 -16
- mindspore/mint/nn/layer/pooling.py +0 -4
- mindspore/nn/__init__.py +1 -3
- mindspore/nn/cell.py +231 -239
- mindspore/nn/layer/activation.py +4 -2
- mindspore/nn/layer/basic.py +56 -14
- mindspore/nn/layer/container.py +16 -0
- mindspore/nn/layer/embedding.py +4 -169
- mindspore/nn/layer/image.py +1 -1
- mindspore/nn/layer/normalization.py +2 -1
- mindspore/nn/layer/thor_layer.py +4 -85
- mindspore/nn/optim/ada_grad.py +0 -1
- mindspore/nn/optim/adafactor.py +0 -1
- mindspore/nn/optim/adam.py +32 -127
- mindspore/nn/optim/adamax.py +0 -1
- mindspore/nn/optim/asgd.py +0 -1
- mindspore/nn/optim/ftrl.py +8 -102
- mindspore/nn/optim/lamb.py +1 -4
- mindspore/nn/optim/lars.py +0 -3
- mindspore/nn/optim/lazyadam.py +25 -218
- mindspore/nn/optim/momentum.py +5 -43
- mindspore/nn/optim/optimizer.py +6 -55
- mindspore/nn/optim/proximal_ada_grad.py +0 -1
- mindspore/nn/optim/rmsprop.py +0 -1
- mindspore/nn/optim/rprop.py +0 -1
- mindspore/nn/optim/sgd.py +0 -1
- mindspore/nn/optim/tft_wrapper.py +2 -4
- mindspore/nn/optim/thor.py +0 -2
- mindspore/nn/probability/bijector/bijector.py +7 -8
- mindspore/nn/probability/bijector/gumbel_cdf.py +2 -2
- mindspore/nn/probability/bijector/power_transform.py +20 -21
- mindspore/nn/probability/bijector/scalar_affine.py +5 -5
- mindspore/nn/probability/bijector/softplus.py +13 -14
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/wrap/cell_wrapper.py +39 -5
- mindspore/nn/wrap/grad_reducer.py +4 -89
- mindspore/numpy/array_creations.py +4 -4
- mindspore/numpy/fft.py +9 -9
- mindspore/numpy/utils_const.py +1 -1
- mindspore/{nn/reinforcement → onnx}/__init__.py +5 -8
- mindspore/onnx/onnx_export.py +137 -0
- mindspore/opencv_core4110.dll +0 -0
- mindspore/opencv_imgcodecs4110.dll +0 -0
- mindspore/{opencv_imgproc452.dll → opencv_imgproc4110.dll} +0 -0
- mindspore/ops/__init__.py +2 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +38 -2
- mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
- mindspore/ops/_op_impl/aicpu/__init__.py +0 -10
- mindspore/ops/_op_impl/cpu/__init__.py +1 -5
- mindspore/ops/_op_impl/cpu/{buffer_append.py → joinedstr_op.py} +8 -8
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +28 -24
- mindspore/ops/auto_generate/gen_extend_func.py +6 -11
- mindspore/ops/auto_generate/gen_ops_def.py +385 -154
- mindspore/ops/auto_generate/gen_ops_prim.py +5676 -5167
- mindspore/ops/communication.py +97 -0
- mindspore/ops/composite/__init__.py +5 -2
- mindspore/ops/composite/base.py +16 -2
- mindspore/ops/composite/multitype_ops/__init__.py +3 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +150 -8
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/composite/multitype_ops/add_impl.py +7 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +27 -0
- mindspore/ops/function/__init__.py +2 -0
- mindspore/ops/function/array_func.py +24 -18
- mindspore/ops/function/comm_func.py +3883 -0
- mindspore/ops/function/debug_func.py +7 -6
- mindspore/ops/function/grad/grad_func.py +4 -12
- mindspore/ops/function/math_func.py +89 -86
- mindspore/ops/function/nn_func.py +92 -313
- mindspore/ops/function/random_func.py +9 -18
- mindspore/ops/functional.py +4 -1
- mindspore/ops/functional_overload.py +377 -30
- mindspore/ops/operations/__init__.py +2 -5
- mindspore/ops/operations/_custom_ops_utils.py +7 -9
- mindspore/ops/operations/_inner_ops.py +12 -50
- mindspore/ops/operations/_rl_inner_ops.py +0 -933
- mindspore/ops/operations/array_ops.py +5 -50
- mindspore/ops/operations/comm_ops.py +95 -17
- mindspore/ops/operations/custom_ops.py +237 -22
- mindspore/ops/operations/debug_ops.py +33 -35
- mindspore/ops/operations/manually_defined/ops_def.py +39 -318
- mindspore/ops/operations/math_ops.py +5 -5
- mindspore/ops/operations/nn_ops.py +3 -3
- mindspore/ops/operations/sparse_ops.py +0 -83
- mindspore/ops/primitive.py +4 -27
- mindspore/ops/tensor_method.py +88 -10
- mindspore/ops_generate/aclnn/aclnn_kernel_register_auto_cc_generator.py +5 -5
- mindspore/ops_generate/aclnn/gen_aclnn_implement.py +8 -8
- mindspore/ops_generate/api/functions_cc_generator.py +53 -4
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +25 -11
- mindspore/ops_generate/common/gen_constants.py +11 -10
- mindspore/ops_generate/common/op_proto.py +18 -1
- mindspore/ops_generate/common/template.py +102 -245
- mindspore/ops_generate/common/template_utils.py +212 -0
- mindspore/ops_generate/gen_custom_ops.py +69 -0
- mindspore/ops_generate/op_def/ops_def_cc_generator.py +78 -7
- mindspore/ops_generate/op_def_py/base_op_prim_py_generator.py +360 -0
- mindspore/ops_generate/op_def_py/custom_op_prim_py_generator.py +140 -0
- mindspore/ops_generate/op_def_py/op_def_py_generator.py +54 -7
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -312
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +74 -17
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +22 -5
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +0 -16
- mindspore/ops_generate/pyboost/op_template_parser.py +3 -2
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +21 -5
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +2 -2
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +30 -10
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +10 -3
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +19 -9
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +71 -28
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +10 -9
- mindspore/ops_generate/pyboost/pyboost_utils.py +27 -16
- mindspore/ops_generate/resources/yaml_loader.py +13 -0
- mindspore/ops_generate/tensor_py_cc_generator.py +2 -2
- mindspore/parallel/_auto_parallel_context.py +5 -15
- mindspore/parallel/_cell_wrapper.py +1 -1
- mindspore/parallel/_parallel_serialization.py +4 -6
- mindspore/parallel/_ps_context.py +2 -2
- mindspore/parallel/_utils.py +34 -17
- mindspore/parallel/auto_parallel.py +23 -9
- mindspore/parallel/checkpoint_transform.py +20 -2
- mindspore/parallel/cluster/process_entity/_api.py +28 -33
- mindspore/parallel/cluster/process_entity/_utils.py +9 -5
- mindspore/parallel/cluster/run.py +5 -3
- mindspore/{experimental/llm_boost/ascend_native → parallel/distributed}/__init__.py +21 -22
- mindspore/parallel/distributed/distributed_data_parallel.py +393 -0
- mindspore/parallel/distributed/flatten_grad_buffer.py +295 -0
- mindspore/parallel/function/reshard_func.py +6 -5
- mindspore/parallel/nn/parallel_cell_wrapper.py +40 -3
- mindspore/parallel/nn/parallel_grad_reducer.py +0 -8
- mindspore/parallel/shard.py +7 -21
- mindspore/parallel/strategy.py +336 -0
- mindspore/parallel/transform_safetensors.py +127 -20
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +13 -9
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +1 -1
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +1 -1
- mindspore/profiler/common/constant.py +5 -0
- mindspore/profiler/common/file_manager.py +9 -0
- mindspore/profiler/common/msprof_cmd_tool.py +40 -4
- mindspore/profiler/common/path_manager.py +65 -24
- mindspore/profiler/common/profiler_context.py +27 -14
- mindspore/profiler/common/profiler_info.py +3 -3
- mindspore/profiler/common/profiler_meta_data.py +1 -0
- mindspore/profiler/common/profiler_op_analyse.py +10 -6
- mindspore/profiler/common/profiler_path_manager.py +13 -0
- mindspore/profiler/common/util.py +30 -3
- mindspore/profiler/dynamic_profiler.py +91 -46
- mindspore/profiler/envprofiler.py +30 -5
- mindspore/profiler/experimental_config.py +18 -2
- mindspore/profiler/platform/cpu_profiler.py +10 -4
- mindspore/profiler/platform/npu_profiler.py +34 -7
- mindspore/profiler/profiler.py +193 -145
- mindspore/profiler/profiler_action_controller.py +1 -1
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
- mindspore/run_check/_check_version.py +108 -24
- mindspore/runtime/__init__.py +9 -6
- mindspore/runtime/executor.py +35 -0
- mindspore/runtime/memory.py +113 -0
- mindspore/runtime/thread_bind_core.py +1 -1
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/{experimental/llm_boost → tools}/__init__.py +5 -5
- mindspore/tools/data_dump.py +130 -0
- mindspore/tools/sdc_detect.py +91 -0
- mindspore/tools/stress_detect.py +63 -0
- mindspore/train/__init__.py +6 -6
- mindspore/train/_utils.py +8 -21
- mindspore/train/amp.py +6 -7
- mindspore/train/callback/_callback.py +2 -1
- mindspore/train/callback/_checkpoint.py +1 -17
- mindspore/train/callback/_flops_collector.py +10 -6
- mindspore/train/callback/_train_fault_tolerance.py +72 -25
- mindspore/train/data_sink.py +5 -9
- mindspore/train/dataset_helper.py +5 -5
- mindspore/train/model.py +41 -230
- mindspore/train/serialization.py +160 -401
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +6 -3
- mindspore/utils/dlpack.py +92 -0
- mindspore/utils/dryrun.py +1 -1
- mindspore/utils/runtime_execution_order_check.py +10 -0
- mindspore/utils/sdc_detect.py +14 -12
- mindspore/utils/stress_detect.py +43 -0
- mindspore/utils/utils.py +152 -16
- mindspore/version.py +1 -1
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/METADATA +3 -2
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/RECORD +330 -344
- mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
- mindspore/communication/_hccl_management.py +0 -297
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +0 -207
- mindspore/experimental/llm_boost/ascend_native/llm_boost.py +0 -52
- mindspore/experimental/llm_boost/atb/__init__.py +0 -23
- mindspore/experimental/llm_boost/atb/boost_base.py +0 -385
- mindspore/experimental/llm_boost/atb/llama_boost.py +0 -137
- mindspore/experimental/llm_boost/atb/qwen_boost.py +0 -124
- mindspore/experimental/llm_boost/register.py +0 -130
- mindspore/experimental/llm_boost/utils.py +0 -31
- mindspore/include/OWNERS +0 -7
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/nn/optim/_dist_optimizer_registry.py +0 -111
- mindspore/nn/reinforcement/_batch_read_write.py +0 -142
- mindspore/nn/reinforcement/_tensors_queue.py +0 -152
- mindspore/nn/reinforcement/tensor_array.py +0 -145
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/ops/_op_impl/aicpu/priority_replay_buffer.py +0 -113
- mindspore/ops/_op_impl/aicpu/reservoir_replay_buffer.py +0 -96
- mindspore/ops/_op_impl/aicpu/sparse_cross.py +0 -42
- mindspore/ops/_op_impl/cpu/buffer_get.py +0 -28
- mindspore/ops/_op_impl/cpu/buffer_sample.py +0 -28
- mindspore/ops/_op_impl/cpu/priority_replay_buffer.py +0 -42
- mindspore/ops/operations/_tensor_array.py +0 -359
- mindspore/ops/operations/rl_ops.py +0 -288
- mindspore/parallel/_offload_context.py +0 -275
- mindspore/parallel/_recovery_context.py +0 -115
- mindspore/parallel/_transformer/__init__.py +0 -35
- mindspore/parallel/_transformer/layers.py +0 -765
- mindspore/parallel/_transformer/loss.py +0 -251
- mindspore/parallel/_transformer/moe.py +0 -693
- mindspore/parallel/_transformer/op_parallel_config.py +0 -222
- mindspore/parallel/_transformer/transformer.py +0 -3124
- mindspore/parallel/mpi/_mpi_config.py +0 -116
- mindspore/profiler/common/validator/validate_path.py +0 -84
- mindspore/train/memory_profiling_pb2.py +0 -298
- mindspore/utils/hooks.py +0 -81
- /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/WHEEL +0 -0
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/entry_points.txt +0 -0
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/top_level.txt +0 -0
|
@@ -21,7 +21,7 @@ except ImportError:
|
|
|
21
21
|
from .device import _is_supported
|
|
22
22
|
|
|
23
23
|
function_status = {'op_compile': False, 'aoe_tune_mode': False,
|
|
24
|
-
'aoe_job_type': False}
|
|
24
|
+
'aoe_job_type': False, 'aclnn_cache': False}
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def op_compile(value):
|
|
@@ -121,3 +121,37 @@ def aoe_job_type(config):
|
|
|
121
121
|
f"For 'aoe_job_type', the config must be one of {aoe_cfgs}, but got {config}."
|
|
122
122
|
)
|
|
123
123
|
AscendOpTuningConf.get_instance().set_aoe_job_type(config)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def aclnn_cache(enable_global_cache=False, cache_queue_length=10000):
|
|
127
|
+
"""
|
|
128
|
+
Configure aclnn cache parameters.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
enable_global_cache (bool): Set the calnn cache to global when GRAPH_MODE.
|
|
132
|
+
Default: ``False``.
|
|
133
|
+
cache_queue_length (int, optional): Set the cache queue length.
|
|
134
|
+
Default: ``10000``.
|
|
135
|
+
|
|
136
|
+
Examples:
|
|
137
|
+
>>> import mindspore as ms
|
|
138
|
+
>>> ms.device_context.ascend.op_tuning.aclnn_cache(True, 10000)
|
|
139
|
+
"""
|
|
140
|
+
if not function_status['aclnn_cache']:
|
|
141
|
+
function_status['aclnn_cache'] = True
|
|
142
|
+
if not _is_supported():
|
|
143
|
+
return
|
|
144
|
+
# Check the configuration environment whether valid
|
|
145
|
+
if AscendOpTuningConf.get_instance().is_aclnn_cache_configured():
|
|
146
|
+
raise RuntimeError("The 'aclnn_cache' can not be set repeatedly.")
|
|
147
|
+
cache_cfgs = [True, False]
|
|
148
|
+
if enable_global_cache not in cache_cfgs:
|
|
149
|
+
raise ValueError(
|
|
150
|
+
f"For 'aclnn_cache', the config must be one of {cache_cfgs}, but got {enable_global_cache}."
|
|
151
|
+
)
|
|
152
|
+
AscendOpTuningConf.get_instance().set_aclnn_global_cache(enable_global_cache)
|
|
153
|
+
if cache_queue_length < 0:
|
|
154
|
+
raise ValueError(
|
|
155
|
+
f"For 'aclnn_cache', the config must greater than 0, but got {enable_global_cache}."
|
|
156
|
+
)
|
|
157
|
+
AscendOpTuningConf.get_instance().set_cache_queue_length(cache_queue_length)
|
mindspore/dnnl.dll
CHANGED
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2025 Huawei Technologies Co., Ltd
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -12,3 +12,11 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
# ============================================================================
|
|
15
|
+
|
|
16
|
+
"""Graph optimization and transformation functionality."""
|
|
17
|
+
|
|
18
|
+
from mindspore.graph.custom_pass import register_custom_pass
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"register_custom_pass"
|
|
22
|
+
]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Copyright 2025 Huawei Technologies Co., Ltd
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
# ============================================================================
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
Experimental custom pass registration functionality.
|
|
18
|
+
|
|
19
|
+
This module provides experimental APIs for registering custom optimization passes.
|
|
20
|
+
These APIs are subject to change and should be used with caution in production code.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
import mindspore._c_expression as _c_expression
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def register_custom_pass(pass_name: str, plugin_so_path: str, device: str = "all", stage: str = "") -> bool:
|
|
27
|
+
"""Register a custom pass plugin.
|
|
28
|
+
|
|
29
|
+
.. warning::
|
|
30
|
+
This is an experimental API that is subject to change or deletion.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
pass_name (str): Name of the pass expected to be provided by the plugin.
|
|
34
|
+
plugin_so_path (str): Absolute path to the plugin shared library (.so file).
|
|
35
|
+
device (str): Target device for the pass. Supported values: "cpu", "gpu", "ascend", or "all".
|
|
36
|
+
Default: "all".
|
|
37
|
+
stage (str): Pass stage. Reserved field for future use. Default: "".
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
bool: True if plugin loaded successfully, False otherwise.
|
|
41
|
+
|
|
42
|
+
Examples:
|
|
43
|
+
>>> import mindspore.graph as graph
|
|
44
|
+
>>> # Register a custom optimization pass
|
|
45
|
+
>>> success = graph.register_custom_pass(
|
|
46
|
+
... pass_name="my_fusion_pass",
|
|
47
|
+
... plugin_so_path="/path/to/my_plugin.so",
|
|
48
|
+
... device="ascend"
|
|
49
|
+
... )
|
|
50
|
+
>>> print(f"Registration successful: {success}")
|
|
51
|
+
"""
|
|
52
|
+
return _c_expression.register_custom_pass(pass_name, plugin_so_path, device, stage)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
__all__ = ["register_custom_pass"]
|
mindspore/include/api/cell.h
CHANGED
|
@@ -31,7 +31,9 @@ using Output = InputAndOutput;
|
|
|
31
31
|
|
|
32
32
|
class MS_API CellBase {
|
|
33
33
|
public:
|
|
34
|
+
/// \brief Constructor of Cellbase.
|
|
34
35
|
CellBase() = default;
|
|
36
|
+
/// \brief Destructor of Cellbase.
|
|
35
37
|
virtual ~CellBase() = default;
|
|
36
38
|
/// \brief Construct using inputs.
|
|
37
39
|
///
|
|
@@ -63,12 +65,21 @@ class MS_API Cell : public CellBase {
|
|
|
63
65
|
class MS_API GraphCell final : public Cell<GraphCell> {
|
|
64
66
|
public:
|
|
65
67
|
class GraphImpl;
|
|
66
|
-
|
|
68
|
+
/// \brief Constructor of GraphCell.
|
|
67
69
|
GraphCell() = default;
|
|
70
|
+
/// \brief Destructor of GraphCell.
|
|
68
71
|
~GraphCell() override = default;
|
|
69
|
-
|
|
72
|
+
/// \brief Constructor of GraphCell.
|
|
73
|
+
///
|
|
74
|
+
/// \param[in] graph Graph to construct.
|
|
70
75
|
explicit GraphCell(const Graph &graph);
|
|
76
|
+
/// \brief Constructor of GraphCell.
|
|
77
|
+
///
|
|
78
|
+
/// \param[in] graph Graph to construct.
|
|
71
79
|
explicit GraphCell(Graph &&graph);
|
|
80
|
+
/// \brief Constructor of GraphCell.
|
|
81
|
+
///
|
|
82
|
+
/// \param[in] graph Graph to construct.
|
|
72
83
|
explicit GraphCell(const std::shared_ptr<Graph> &graph);
|
|
73
84
|
/// \brief Set a context.
|
|
74
85
|
///
|
|
@@ -109,12 +120,25 @@ class MS_API GraphCell final : public Cell<GraphCell> {
|
|
|
109
120
|
|
|
110
121
|
class MS_API InputAndOutput {
|
|
111
122
|
public:
|
|
123
|
+
/// \brief Constructor of InputAndOutput.
|
|
112
124
|
InputAndOutput();
|
|
125
|
+
/// \brief Destructor of InputAndOutput.
|
|
113
126
|
~InputAndOutput() = default;
|
|
114
|
-
|
|
127
|
+
/// \brief Constructor of InputAndOutput.
|
|
128
|
+
///
|
|
129
|
+
/// \param[in] cell The cellbase.
|
|
130
|
+
///
|
|
131
|
+
/// \param[in] prev The previous inputs/outputs.
|
|
132
|
+
///
|
|
133
|
+
/// \param[in] index Index of inputs/outputs.
|
|
115
134
|
InputAndOutput(const std::shared_ptr<CellBase> &cell, const std::vector<InputAndOutput> &prev, int32_t index);
|
|
116
|
-
|
|
135
|
+
/// \brief Get index.
|
|
136
|
+
///
|
|
137
|
+
/// \return index Index of inputs/outputs.
|
|
117
138
|
int32_t GetIndex() const { return index_; }
|
|
139
|
+
/// \brief Set index.
|
|
140
|
+
///
|
|
141
|
+
/// \param[in] index Index to be set.
|
|
118
142
|
void SetIndex(int32_t index) { index_ = index; }
|
|
119
143
|
|
|
120
144
|
private:
|
mindspore/include/api/cfg.h
CHANGED
|
@@ -28,35 +28,50 @@ namespace mindspore {
|
|
|
28
28
|
constexpr int iter_th = 1000;
|
|
29
29
|
class MS_API MixPrecisionCfg {
|
|
30
30
|
public:
|
|
31
|
+
/// \brief Constructor of mix precision training config.
|
|
31
32
|
MixPrecisionCfg() {
|
|
32
33
|
this->dynamic_loss_scale_ = false;
|
|
33
34
|
this->loss_scale_ = 128.0f;
|
|
34
35
|
this->keep_batchnorm_fp32_ = true;
|
|
35
36
|
this->num_of_not_nan_iter_th_ = iter_th;
|
|
36
37
|
}
|
|
38
|
+
/// \brief Constructor of mix precision training config.
|
|
39
|
+
///
|
|
40
|
+
/// \param[in] rhs The config of mix precision.
|
|
37
41
|
MixPrecisionCfg(const MixPrecisionCfg &rhs) {
|
|
38
42
|
this->dynamic_loss_scale_ = rhs.dynamic_loss_scale_;
|
|
39
43
|
this->loss_scale_ = rhs.loss_scale_;
|
|
40
44
|
this->keep_batchnorm_fp32_ = rhs.keep_batchnorm_fp32_;
|
|
41
45
|
this->num_of_not_nan_iter_th_ = rhs.num_of_not_nan_iter_th_;
|
|
42
46
|
}
|
|
47
|
+
/// \brief Destructor of mix precision config.
|
|
43
48
|
~MixPrecisionCfg() = default;
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
/// \brief Enable/disable dynamic loss scale during mix precision training.
|
|
51
|
+
bool dynamic_loss_scale_ = false;
|
|
52
|
+
/// \brief Initial loss scale factor.
|
|
53
|
+
float loss_scale_;
|
|
54
|
+
/// \brief Keep batch norm in FP32 while training.
|
|
55
|
+
bool keep_batchnorm_fp32_ = true;
|
|
56
|
+
/// \brief A threshold for modifying loss scale when dynamic loss scale is enabled.
|
|
57
|
+
uint32_t num_of_not_nan_iter_th_;
|
|
58
|
+
/// \brief Is mix precision model export from mindspore.
|
|
59
|
+
bool is_raw_mix_precision_ = false;
|
|
50
60
|
};
|
|
51
61
|
|
|
52
62
|
class MS_API TrainCfg {
|
|
53
63
|
public:
|
|
64
|
+
/// \brief Constructor of training config.
|
|
54
65
|
TrainCfg() = default;
|
|
66
|
+
/// \brief Constructor of training config.
|
|
67
|
+
///
|
|
68
|
+
/// \param[in] rhs The training config.
|
|
55
69
|
TrainCfg(const TrainCfg &rhs) {
|
|
56
70
|
this->loss_name_ = rhs.loss_name_;
|
|
57
71
|
this->mix_precision_cfg_ = rhs.mix_precision_cfg_;
|
|
58
72
|
this->accumulate_gradients_ = rhs.accumulate_gradients_;
|
|
59
73
|
}
|
|
74
|
+
/// \brief Destructor of training config.
|
|
60
75
|
~TrainCfg() = default;
|
|
61
76
|
|
|
62
77
|
/// \brief obtain part of the name that identify a loss kernel.
|
|
@@ -67,9 +82,11 @@ class MS_API TrainCfg {
|
|
|
67
82
|
///
|
|
68
83
|
/// \param[in] loss_name define part of the name that identify a loss kernel.
|
|
69
84
|
inline void SetLossName(const std::vector<std::string> &loss_name);
|
|
70
|
-
|
|
85
|
+
/// \brief Optimization level.
|
|
71
86
|
OptimizationLevel optimization_level_ = kO0;
|
|
72
|
-
|
|
87
|
+
/// \brief Mix precision configuration.
|
|
88
|
+
MixPrecisionCfg mix_precision_cfg_;
|
|
89
|
+
/// \brief If accumulate gradients is used.
|
|
73
90
|
bool accumulate_gradients_ = false;
|
|
74
91
|
|
|
75
92
|
private:
|
mindspore/include/api/context.h
CHANGED
mindspore/include/api/delegate.h
CHANGED
|
@@ -129,7 +129,6 @@ class Delegate : public IDelegate<LiteDelegateGraph, kernel::Kernel, kernel::Ker
|
|
|
129
129
|
///
|
|
130
130
|
/// \return Status. If Status is kLiteNotSupport, the program will return to the MindSpore Lite inner inference.
|
|
131
131
|
virtual Status Init() = 0;
|
|
132
|
-
|
|
133
132
|
/// \brief Create kernel.
|
|
134
133
|
///
|
|
135
134
|
/// \param[in] node The kernel to be created.
|
|
@@ -139,7 +138,6 @@ class Delegate : public IDelegate<LiteDelegateGraph, kernel::Kernel, kernel::Ker
|
|
|
139
138
|
// return node as kernel since they are same one.
|
|
140
139
|
return node;
|
|
141
140
|
}
|
|
142
|
-
|
|
143
141
|
/// \brief Check if the node is delegate node.
|
|
144
142
|
///
|
|
145
143
|
/// \param[in] node The kernel to verify.
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
|
|
29
29
|
namespace mindspore {
|
|
30
30
|
using VecChar = std::vector<char>;
|
|
31
|
+
/// \brief Transform string to char.
|
|
32
|
+
///
|
|
33
|
+
/// \param[in] s Define the string to transform.
|
|
34
|
+
///
|
|
35
|
+
/// \return Vector of chars.
|
|
31
36
|
inline std::vector<char> StringToChar(const std::string &s) {
|
|
32
37
|
if (s.empty()) {
|
|
33
38
|
const auto empty = std::vector<char>();
|
|
@@ -35,7 +40,11 @@ inline std::vector<char> StringToChar(const std::string &s) {
|
|
|
35
40
|
}
|
|
36
41
|
return std::vector<char>(s.begin(), s.end());
|
|
37
42
|
}
|
|
38
|
-
|
|
43
|
+
/// \brief Transform char to string.
|
|
44
|
+
///
|
|
45
|
+
/// \param[in] c Define the chars to transform.
|
|
46
|
+
///
|
|
47
|
+
/// \return String.
|
|
39
48
|
inline std::string CharToString(const std::vector<char> &c) {
|
|
40
49
|
if (c.empty()) {
|
|
41
50
|
const auto empty = "";
|
|
@@ -43,43 +52,71 @@ inline std::string CharToString(const std::vector<char> &c) {
|
|
|
43
52
|
}
|
|
44
53
|
return std::string(c.begin(), c.end());
|
|
45
54
|
}
|
|
46
|
-
|
|
55
|
+
/// \brief Transform pair of string to char.
|
|
56
|
+
///
|
|
57
|
+
/// \param[in] s Pair of strings to transform.
|
|
58
|
+
///
|
|
59
|
+
/// \return Pair of chars.
|
|
47
60
|
inline std::pair<std::vector<char>, int32_t> PairStringToChar(const std::pair<std::string, int32_t> &s) {
|
|
48
61
|
return std::pair<std::vector<char>, int32_t>(std::vector<char>(s.first.begin(), s.first.end()), s.second);
|
|
49
62
|
}
|
|
50
|
-
|
|
63
|
+
/// \brief Transform pair of char to string.
|
|
64
|
+
///
|
|
65
|
+
/// \param[in] c Pair of chars to transform.
|
|
66
|
+
///
|
|
67
|
+
/// \return Pair of strings.
|
|
51
68
|
inline std::pair<std::string, int32_t> PairCharToString(const std::pair<std::vector<char>, int32_t> &c) {
|
|
52
69
|
return std::pair<std::string, int32_t>(std::string(c.first.begin(), c.first.end()), c.second);
|
|
53
70
|
}
|
|
54
|
-
|
|
71
|
+
/// \brief Transform vector of string to chars.
|
|
72
|
+
///
|
|
73
|
+
/// \param[in] s Vector of strings.
|
|
74
|
+
///
|
|
75
|
+
/// \return Vector of vector of chars.
|
|
55
76
|
inline std::vector<std::vector<char>> VectorStringToChar(const std::vector<std::string> &s) {
|
|
56
77
|
std::vector<std::vector<char>> ret;
|
|
57
78
|
std::transform(s.begin(), s.end(), std::back_inserter(ret),
|
|
58
79
|
[](auto str) { return std::vector<char>(str.begin(), str.end()); });
|
|
59
80
|
return ret;
|
|
60
81
|
}
|
|
61
|
-
|
|
82
|
+
/// \brief Transform vector of chars to strings.
|
|
83
|
+
///
|
|
84
|
+
/// \param[in] c Vector of vector ofof schars.
|
|
85
|
+
///
|
|
86
|
+
/// \return Vector of strings.
|
|
62
87
|
inline std::vector<std::string> VectorCharToString(const std::vector<std::vector<char>> &c) {
|
|
63
88
|
std::vector<std::string> ret;
|
|
64
89
|
std::transform(c.begin(), c.end(), std::back_inserter(ret),
|
|
65
90
|
[](auto ch) { return std::string(ch.begin(), ch.end()); });
|
|
66
91
|
return ret;
|
|
67
92
|
}
|
|
68
|
-
|
|
93
|
+
/// \brief Transform set of strings to chars.
|
|
94
|
+
///
|
|
95
|
+
/// \param[in] s Set of strings.
|
|
96
|
+
///
|
|
97
|
+
/// \return Set of vector of chars.
|
|
69
98
|
inline std::set<std::vector<char>> SetStringToChar(const std::set<std::string> &s) {
|
|
70
99
|
std::set<std::vector<char>> ret;
|
|
71
100
|
std::transform(s.begin(), s.end(), std::inserter(ret, ret.begin()),
|
|
72
101
|
[](auto str) { return std::vector<char>(str.begin(), str.end()); });
|
|
73
102
|
return ret;
|
|
74
103
|
}
|
|
75
|
-
|
|
104
|
+
/// \brief Transform set of chars to strings.
|
|
105
|
+
///
|
|
106
|
+
/// \param[in] c Set of chars.
|
|
107
|
+
///
|
|
108
|
+
/// \return Set of strings.
|
|
76
109
|
inline std::set<std::string> SetCharToString(const std::set<std::vector<char>> &c) {
|
|
77
110
|
std::set<std::string> ret;
|
|
78
111
|
std::transform(c.begin(), c.end(), std::inserter(ret, ret.begin()),
|
|
79
112
|
[](auto ch) { return std::string(ch.begin(), ch.end()); });
|
|
80
113
|
return ret;
|
|
81
114
|
}
|
|
82
|
-
|
|
115
|
+
/// \brief Transform map of strings to chars.
|
|
116
|
+
///
|
|
117
|
+
/// \param[in] s Map of strings.
|
|
118
|
+
///
|
|
119
|
+
/// \return Map of vector of chars.
|
|
83
120
|
template <class T>
|
|
84
121
|
inline std::map<std::vector<char>, T> MapStringToChar(const std::map<std::string, T> &s) {
|
|
85
122
|
std::map<std::vector<char>, T> ret;
|
|
@@ -88,7 +125,11 @@ inline std::map<std::vector<char>, T> MapStringToChar(const std::map<std::string
|
|
|
88
125
|
});
|
|
89
126
|
return ret;
|
|
90
127
|
}
|
|
91
|
-
|
|
128
|
+
/// \brief Transform map of chars to strings.
|
|
129
|
+
///
|
|
130
|
+
/// \param[in] c Map of vector of chars.
|
|
131
|
+
///
|
|
132
|
+
/// \return Map of strings.
|
|
92
133
|
template <class T>
|
|
93
134
|
inline std::map<std::string, T> MapCharToString(const std::map<std::vector<char>, T> &c) {
|
|
94
135
|
std::map<std::string, T> ret;
|
|
@@ -97,7 +138,11 @@ inline std::map<std::string, T> MapCharToString(const std::map<std::vector<char>
|
|
|
97
138
|
});
|
|
98
139
|
return ret;
|
|
99
140
|
}
|
|
100
|
-
|
|
141
|
+
/// \brief Transform unordered map of strings to chars.
|
|
142
|
+
///
|
|
143
|
+
/// \param[in] s Unordered_map of strings.
|
|
144
|
+
///
|
|
145
|
+
/// \return Map of vector of chars.
|
|
101
146
|
inline std::map<std::vector<char>, std::vector<char>> UnorderedMapStringToChar(
|
|
102
147
|
const std::unordered_map<std::string, std::string> &s) {
|
|
103
148
|
std::map<std::vector<char>, std::vector<char>> ret;
|
|
@@ -107,7 +152,11 @@ inline std::map<std::vector<char>, std::vector<char>> UnorderedMapStringToChar(
|
|
|
107
152
|
});
|
|
108
153
|
return ret;
|
|
109
154
|
}
|
|
110
|
-
|
|
155
|
+
/// \brief Transform unordered map of chars to strings.
|
|
156
|
+
///
|
|
157
|
+
/// \param[in] c Map of vector of chars.
|
|
158
|
+
///
|
|
159
|
+
/// \return Unordered map of strings.
|
|
111
160
|
inline std::unordered_map<std::string, std::string> UnorderedMapCharToString(
|
|
112
161
|
const std::map<std::vector<char>, std::vector<char>> &c) {
|
|
113
162
|
std::unordered_map<std::string, std::string> ret;
|
|
@@ -117,7 +166,11 @@ inline std::unordered_map<std::string, std::string> UnorderedMapCharToString(
|
|
|
117
166
|
});
|
|
118
167
|
return ret;
|
|
119
168
|
}
|
|
120
|
-
|
|
169
|
+
/// \brief Transform map of strings to vector of chars.
|
|
170
|
+
///
|
|
171
|
+
/// \param[in] s Map of vector of strings.
|
|
172
|
+
///
|
|
173
|
+
/// \return Map of vector of chars.
|
|
121
174
|
inline std::map<std::vector<char>, std::vector<char>> MapStringToVectorChar(
|
|
122
175
|
const std::map<std::string, std::string> &s) {
|
|
123
176
|
std::map<std::vector<char>, std::vector<char>> ret;
|
|
@@ -127,7 +180,11 @@ inline std::map<std::vector<char>, std::vector<char>> MapStringToVectorChar(
|
|
|
127
180
|
});
|
|
128
181
|
return ret;
|
|
129
182
|
}
|
|
130
|
-
|
|
183
|
+
/// \brief Transform map of chars to strings.
|
|
184
|
+
///
|
|
185
|
+
/// \param[in] c Map of vector of chars.
|
|
186
|
+
///
|
|
187
|
+
/// \return Map of strings.
|
|
131
188
|
inline std::map<std::string, std::string> MapVectorCharToString(
|
|
132
189
|
const std::map<std::vector<char>, std::vector<char>> &c) {
|
|
133
190
|
std::map<std::string, std::string> ret;
|
|
@@ -137,7 +194,11 @@ inline std::map<std::string, std::string> MapVectorCharToString(
|
|
|
137
194
|
});
|
|
138
195
|
return ret;
|
|
139
196
|
}
|
|
140
|
-
|
|
197
|
+
/// \brief Transform class index string to char.
|
|
198
|
+
///
|
|
199
|
+
/// \param[in] s Vector of pair of strings.
|
|
200
|
+
///
|
|
201
|
+
/// \return Vector of pair of vector of chars.
|
|
141
202
|
inline std::vector<std::pair<std::vector<char>, std::vector<int32_t>>> ClassIndexStringToChar(
|
|
142
203
|
const std::vector<std::pair<std::string, std::vector<int32_t>>> &s) {
|
|
143
204
|
std::vector<std::pair<std::vector<char>, std::vector<int32_t>>> ret;
|
|
@@ -147,7 +208,11 @@ inline std::vector<std::pair<std::vector<char>, std::vector<int32_t>>> ClassInde
|
|
|
147
208
|
});
|
|
148
209
|
return ret;
|
|
149
210
|
}
|
|
150
|
-
|
|
211
|
+
/// \brief Transform class index char to string.
|
|
212
|
+
///
|
|
213
|
+
/// \param[in] c Vector of pair of schar.
|
|
214
|
+
///
|
|
215
|
+
/// \return Vector of pair of vector of strings.
|
|
151
216
|
inline std::vector<std::pair<std::string, std::vector<int32_t>>> ClassIndexCharToString(
|
|
152
217
|
const std::vector<std::pair<std::vector<char>, std::vector<int32_t>>> &c) {
|
|
153
218
|
std::vector<std::pair<std::string, std::vector<int32_t>>> ret;
|
|
@@ -156,7 +221,11 @@ inline std::vector<std::pair<std::string, std::vector<int32_t>>> ClassIndexCharT
|
|
|
156
221
|
});
|
|
157
222
|
return ret;
|
|
158
223
|
}
|
|
159
|
-
|
|
224
|
+
/// \brief Transform pair string of int64 to pair char of int64.
|
|
225
|
+
///
|
|
226
|
+
/// \param[in] s Vector of pair of strings.
|
|
227
|
+
///
|
|
228
|
+
/// \return Vector of pair of vector of chars.
|
|
160
229
|
inline std::vector<std::pair<std::vector<char>, int64_t>> PairStringInt64ToPairCharInt64(
|
|
161
230
|
const std::vector<std::pair<std::string, int64_t>> &s) {
|
|
162
231
|
std::vector<std::pair<std::vector<char>, int64_t>> ret;
|
|
@@ -165,7 +234,11 @@ inline std::vector<std::pair<std::vector<char>, int64_t>> PairStringInt64ToPairC
|
|
|
165
234
|
});
|
|
166
235
|
return ret;
|
|
167
236
|
}
|
|
168
|
-
|
|
237
|
+
/// \brief Transform tensor map of char to string.
|
|
238
|
+
///
|
|
239
|
+
/// \param[in] c Map of Vector of chars.
|
|
240
|
+
///
|
|
241
|
+
/// \param[in] s Unordered map of strings, which will be changed after the function.
|
|
169
242
|
template <class T>
|
|
170
243
|
inline void TensorMapCharToString(const std::map<std::vector<char>, T> *c, std::unordered_map<std::string, T> *s) {
|
|
171
244
|
if (c == nullptr || s == nullptr) {
|
|
@@ -177,7 +250,11 @@ inline void TensorMapCharToString(const std::map<std::vector<char>, T> *c, std::
|
|
|
177
250
|
s->insert(std::pair<std::string, T>(key, val));
|
|
178
251
|
}
|
|
179
252
|
}
|
|
180
|
-
|
|
253
|
+
/// \brief Transform map of map of chars to map of strings.
|
|
254
|
+
///
|
|
255
|
+
/// \param[in] c Map of map of chars.
|
|
256
|
+
///
|
|
257
|
+
/// \return Map of strings.
|
|
181
258
|
inline std::map<std::string, std::map<std::string, std::string>> MapMapCharToString(
|
|
182
259
|
const std::map<std::vector<char>, std::map<std::vector<char>, std::vector<char>>> &c) {
|
|
183
260
|
std::map<std::string, std::map<std::string, std::string>> ret;
|
|
@@ -191,7 +268,11 @@ inline std::map<std::string, std::map<std::string, std::string>> MapMapCharToStr
|
|
|
191
268
|
}
|
|
192
269
|
return ret;
|
|
193
270
|
}
|
|
194
|
-
|
|
271
|
+
/// \brief Transform map of map of strings to map of chars.
|
|
272
|
+
///
|
|
273
|
+
/// \param[in] s Map of map of strings.
|
|
274
|
+
///
|
|
275
|
+
/// \return Map of chars.
|
|
195
276
|
inline std::map<std::vector<char>, std::map<std::vector<char>, std::vector<char>>> MapMapStringToChar(
|
|
196
277
|
const std::map<std::string, std::map<std::string, std::string>> &s) {
|
|
197
278
|
std::map<std::vector<char>, std::map<std::vector<char>, std::vector<char>>> ret;
|
mindspore/include/api/graph.h
CHANGED
|
@@ -27,14 +27,27 @@ namespace mindspore {
|
|
|
27
27
|
class MS_API Graph {
|
|
28
28
|
public:
|
|
29
29
|
class GraphData;
|
|
30
|
+
/// \brief Constructor of graph.
|
|
30
31
|
Graph();
|
|
32
|
+
/// \brief Constructor of graph.
|
|
33
|
+
///
|
|
34
|
+
/// \param[in] graph_data define the graph_data of graph.
|
|
31
35
|
explicit Graph(const std::shared_ptr<GraphData> &graph_data);
|
|
36
|
+
/// \brief Constructor of graph.
|
|
37
|
+
///
|
|
38
|
+
/// \param[in] graph_data define the graph_data of graph.
|
|
32
39
|
explicit Graph(std::shared_ptr<GraphData> &&graph_data);
|
|
40
|
+
/// \brief Constructor of Kernel.
|
|
33
41
|
explicit Graph(std::nullptr_t);
|
|
42
|
+
/// \brief Destructor of graph.
|
|
34
43
|
~Graph();
|
|
35
|
-
|
|
44
|
+
/// \brief Get graph's modeltype.
|
|
45
|
+
///
|
|
46
|
+
/// \return Model type.
|
|
36
47
|
enum ModelType ModelType() const;
|
|
48
|
+
/// \brief Operator equal.
|
|
37
49
|
bool operator==(std::nullptr_t) const;
|
|
50
|
+
/// \brief Operator not equal.
|
|
38
51
|
bool operator!=(std::nullptr_t) const;
|
|
39
52
|
|
|
40
53
|
private:
|
mindspore/include/api/kernel.h
CHANGED
|
@@ -28,22 +28,35 @@
|
|
|
28
28
|
namespace mindspore::kernel {
|
|
29
29
|
class MS_API Kernel : public IKernel<schema::Primitive> {
|
|
30
30
|
public:
|
|
31
|
+
/// \brief Constructor of Kernel.
|
|
31
32
|
Kernel() = default;
|
|
33
|
+
/// \brief Constructor of Kernel.
|
|
34
|
+
///
|
|
35
|
+
/// \param[in] inputs Input tensors.
|
|
36
|
+
///
|
|
37
|
+
/// \param[in] outputs Output tensors.
|
|
38
|
+
///
|
|
39
|
+
/// \param[in] primitive The primitive of kernel.
|
|
40
|
+
///
|
|
41
|
+
/// \param[in] context The context created.
|
|
32
42
|
Kernel(const std::vector<mindspore::MSTensor> &inputs, const std::vector<mindspore::MSTensor> &outputs,
|
|
33
43
|
const schema::Primitive *primitive, const mindspore::Context *ctx)
|
|
34
44
|
: IKernel<schema::Primitive>(inputs, outputs, primitive, ctx) {
|
|
35
45
|
Initialize();
|
|
36
46
|
}
|
|
47
|
+
/// \brief Destructor of Kernel.
|
|
37
48
|
virtual ~Kernel() = default;
|
|
38
|
-
|
|
49
|
+
/// \brief infer kernel's shape.
|
|
50
|
+
///
|
|
51
|
+
/// \return status.
|
|
39
52
|
int InferShape() override;
|
|
40
53
|
/// \brief obtain kernel's type.
|
|
41
54
|
///
|
|
42
55
|
/// \return kernel's type.
|
|
43
56
|
virtual schema::PrimitiveType type() const { return type_; }
|
|
44
|
-
/// \brief
|
|
57
|
+
/// \brief Obtain kernel's quant type.
|
|
45
58
|
///
|
|
46
|
-
/// \return
|
|
59
|
+
/// \return Kernel's quant type.
|
|
47
60
|
virtual schema::QuantType quant_type() const { return quant_type_; }
|
|
48
61
|
/// \brief obtain the primitive of kernel generated by flatbuffers.
|
|
49
62
|
protected:
|
|
@@ -28,6 +28,7 @@ namespace kernel {
|
|
|
28
28
|
/// \brief The Kernel class is used to define a MindSpore Kernel.
|
|
29
29
|
class MS_API MSKernel {
|
|
30
30
|
public:
|
|
31
|
+
/// \brief Constructor of MSKernel.
|
|
31
32
|
MSKernel() = default;
|
|
32
33
|
/// \brief Constructor.
|
|
33
34
|
///
|
|
@@ -130,12 +131,17 @@ class MS_API MSKernel {
|
|
|
130
131
|
/// \param[in] key define the kernel's attribute key.
|
|
131
132
|
/// \param[in] value define the kernel's attribute value.
|
|
132
133
|
void SetAttr(const std::string &key, const std::string &value) { attrs_[key] = value; }
|
|
133
|
-
|
|
134
|
+
/// \brief kernel's name.
|
|
134
135
|
std::string name_;
|
|
136
|
+
/// \brief kernel's context.
|
|
135
137
|
const mindspore::Context *context_ = nullptr;
|
|
138
|
+
/// \brief kernel's inputs.
|
|
136
139
|
std::vector<mindspore::MSTensor> inputs_;
|
|
140
|
+
/// \brief kernel's outputs.
|
|
137
141
|
std::vector<mindspore::MSTensor> outputs_;
|
|
142
|
+
/// \brief kernel's attrs.
|
|
138
143
|
std::map<std::string, std::string> attrs_;
|
|
144
|
+
/// \brief kernel's config.
|
|
139
145
|
const std::map<std::string, std::map<std::string, std::string>> *config_ = nullptr;
|
|
140
146
|
};
|
|
141
147
|
|
|
@@ -143,6 +149,7 @@ class MS_API MSKernel {
|
|
|
143
149
|
template <typename Primitive>
|
|
144
150
|
class MS_API IKernel : public MSKernel {
|
|
145
151
|
public:
|
|
152
|
+
/// \brief Constructor of IKernel.
|
|
146
153
|
IKernel() = default;
|
|
147
154
|
/// \brief Constructor.
|
|
148
155
|
///
|
|
@@ -161,6 +168,7 @@ class MS_API IKernel : public MSKernel {
|
|
|
161
168
|
const Primitive *primitive() const { return this->primitive_; }
|
|
162
169
|
|
|
163
170
|
protected:
|
|
171
|
+
/// \brief kernel's primitive, which is deserialized from flatbuffers.
|
|
164
172
|
const Primitive *primitive_ = nullptr;
|
|
165
173
|
};
|
|
166
174
|
} // namespace kernel
|
|
@@ -25,10 +25,19 @@ constexpr int METRICS_MULTILABEL = 1;
|
|
|
25
25
|
|
|
26
26
|
class MS_API AccuracyMetrics : public Metrics {
|
|
27
27
|
public:
|
|
28
|
+
/// \brief Constructor of AccuracyMetrics.
|
|
29
|
+
///
|
|
30
|
+
/// \param[in] accuracy_metrics The metrics of accuracy.
|
|
31
|
+
/// \param[in] input_indexes The indexes of inputs.
|
|
32
|
+
/// \param[in] output_indexes The indexes of outputs.
|
|
33
|
+
|
|
28
34
|
explicit AccuracyMetrics(int accuracy_metrics = METRICS_CLASSIFICATION, const std::vector<int> &input_indexes = {1},
|
|
29
35
|
const std::vector<int> &output_indexes = {0});
|
|
36
|
+
/// \brief Destructor of AccuracyMetrics.
|
|
30
37
|
virtual ~AccuracyMetrics();
|
|
38
|
+
/// \brief Clear the accuracy metrics.
|
|
31
39
|
void Clear() override;
|
|
40
|
+
/// \brief Eval function.
|
|
32
41
|
float Eval() override;
|
|
33
42
|
};
|
|
34
43
|
|