mindspore 2.3.0__cp39-none-any.whl → 2.3.0rc2__cp39-none-any.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/Third_Party_Open_Source_Software_Notice +0 -1512
- mindspore/__init__.py +1 -2
- mindspore/_c_dataengine.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/_c_expression.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/_c_mindrecord.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/_checkparam.py +25 -5
- mindspore/_extends/graph_kernel/model/graph_parallel.py +1 -1
- mindspore/_extends/parse/__init__.py +2 -2
- mindspore/_extends/parse/compile_config.py +0 -29
- mindspore/_extends/parse/namespace.py +2 -2
- mindspore/_extends/parse/parser.py +5 -21
- mindspore/_extends/parse/resources.py +7 -5
- mindspore/_extends/parse/standard_method.py +59 -40
- mindspore/_mindspore_offline_debug.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/amp.py +5 -26
- mindspore/bin/cache_admin +0 -0
- mindspore/bin/cache_server +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/base.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +1 -1
- mindspore/boost/grad_freeze.py +2 -2
- mindspore/boost/less_batch_normalization.py +6 -9
- mindspore/common/__init__.py +1 -8
- mindspore/common/_register_for_tensor.py +9 -8
- mindspore/common/api.py +65 -275
- mindspore/common/dtype.py +4 -8
- mindspore/common/dump.py +5 -2
- mindspore/common/jit_config.py +1 -1
- mindspore/common/lazy_inline.py +2 -14
- mindspore/common/parameter.py +15 -14
- mindspore/common/recompute.py +5 -20
- mindspore/common/sparse_tensor.py +6 -21
- mindspore/common/tensor.py +52 -100
- mindspore/communication/__init__.py +11 -6
- mindspore/communication/management.py +94 -92
- mindspore/context.py +18 -180
- mindspore/dataset/engine/datasets.py +46 -69
- mindspore/dataset/engine/datasets_user_defined.py +53 -72
- mindspore/dataset/engine/datasets_vision.py +2 -2
- mindspore/dataset/engine/queue.py +38 -56
- mindspore/dataset/engine/validators.py +5 -11
- mindspore/dataset/vision/__init__.py +5 -5
- mindspore/dataset/vision/c_transforms.py +5 -5
- mindspore/dataset/vision/py_transforms_util.py +1 -1
- mindspore/dataset/vision/transforms.py +46 -591
- mindspore/dataset/vision/utils.py +1 -121
- mindspore/dataset/vision/validators.py +3 -9
- mindspore/hal/__init__.py +1 -7
- mindspore/hal/device.py +1 -1
- mindspore/include/api/model.h +0 -3
- mindspore/include/dataset/vision.h +2 -54
- mindspore/include/mindapi/base/types.h +0 -1
- mindspore/lib/libdnnl.so.2 +0 -0
- mindspore/lib/libmindspore.so +0 -0
- mindspore/lib/libmindspore_backend.so +0 -0
- mindspore/lib/libmindspore_common.so +0 -0
- mindspore/lib/libmindspore_core.so +0 -0
- mindspore/lib/libmindspore_glog.so.0 +0 -0
- mindspore/lib/libmindspore_gpr.so.15 +0 -0
- mindspore/lib/libmindspore_grpc++.so.1 +0 -0
- mindspore/lib/libmindspore_grpc.so.15 +0 -0
- mindspore/lib/libmindspore_shared_lib.so +0 -0
- mindspore/lib/libmpi_adapter.so +0 -0
- mindspore/lib/libmpi_collective.so +0 -0
- mindspore/lib/libnnacl.so +0 -0
- mindspore/lib/libopencv_core.so.4.5 +0 -0
- mindspore/lib/libps_cache.so +0 -0
- mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/config/ascend310p/aic-ascend310p-ops-info.json +0 -35
- mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
- mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/vector_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_cpu_kernels.so +0 -0
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/config/cust_aicpu_kernel.json +0 -72
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/{aclnn_all_finite.h → aclnn_add_custom.h} +11 -9
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_decoder_kv_cache.h +1 -1
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_prompt_kv_cache.h +1 -1
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/lib/libcust_opapi.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend310p/aic-ascend310p-ops-info.json +12 -184
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910/aic-ascend910-ops-info.json +15 -7
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910b/aic-ascend910b-ops-info.json +15 -7
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.cpp +81 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.py +134 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/decoder_kv_cache.py +31 -77
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/prompt_kv_cache.py +31 -77
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/lib/linux/aarch64/libcust_opmaster_rt2.0.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/liboptiling.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/inc/op_proto.h +5 -4
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/lib/linux/aarch64/libcust_opsproto_rt2.0.so +0 -0
- mindspore/lib/plugin/ascend/libascend_collective.so +0 -0
- mindspore/lib/plugin/ascend/libdvpp_utils.so +0 -0
- mindspore/lib/plugin/ascend/libhccl_plugin.so +0 -0
- mindspore/lib/plugin/ascend/liblowlatency_collective.so +0 -0
- mindspore/lib/plugin/ascend/libmindspore_cpu_kernels.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/DeviceBin +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/PkgInspect +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/op_man +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/device/ascend910b/bin/ascend910b.bin +286 -275
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_cann_host.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_host.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops_static.a +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/add/add_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/apply_rotary_pos_emb_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/asdop/asd_op_impl.h +0 -3
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/backend_param.h +0 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/cast/cast_tiling.h +45 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/compare/compare_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/flash_attention_score_impl.h +4 -8
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/flash_attention_score_tiling.h +4 -11
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/kernel/flash_attention_score_mix_hwsync.h +0 -18
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_kernel.h +0 -6
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_rtbackend.h +75 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/kernel/matmul.h +5 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/matmul_impl.h +3 -18
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/pp_matmul_common_tiling.h +5 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/pp_matmul_info.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/tiling_data.h +3 -36
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/kernel/matmul_stridedslice_fusion.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/matmul_stridedslice_fusion_impl.h +4 -22
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/op_param.h +2 -16
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/kernel/paged_attention_mix_hwsync.h +3 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_impl.h +4 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_tiling.h +4 -9
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/attention_param.h +2 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_ext_param.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_qkv_param.h +4 -10
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/sub_param.h +12 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/rms_norm_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tune_repo/matmul_table.h +1 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/backend.h +2 -10
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/elewise_utils.h +1 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_tiling.h +0 -17
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/math.h +7 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libAdd_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libSub_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_layernorm_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_rms_norm_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libcast_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libgelu_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_stridedslice_fusion_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libms_kernels_internal.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libnot_equal_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/librms_norm_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblcal.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblccl_wrapper.so +0 -0
- mindspore/lib/plugin/libmindspore_ascend.so.2 +0 -0
- mindspore/mindrecord/filewriter.py +2 -2
- mindspore/mint/__init__.py +40 -720
- mindspore/mint/nn/__init__.py +7 -89
- mindspore/mint/nn/functional.py +16 -165
- mindspore/mint/optim/adamw.py +16 -15
- mindspore/nn/__init__.py +2 -0
- mindspore/nn/cell.py +98 -97
- mindspore/nn/extend/basic.py +2 -2
- mindspore/nn/extend/embedding.py +1 -1
- mindspore/nn/extend/layer/normalization.py +5 -7
- mindspore/nn/generator.py +297 -0
- mindspore/nn/layer/activation.py +3 -4
- mindspore/nn/layer/basic.py +16 -79
- mindspore/nn/layer/conv.py +8 -17
- mindspore/nn/layer/embedding.py +4 -1
- mindspore/nn/layer/math.py +1 -1
- mindspore/nn/layer/normalization.py +1 -1
- mindspore/nn/layer/pooling.py +0 -5
- mindspore/nn/layer/rnn_cells.py +2 -2
- mindspore/nn/loss/loss.py +19 -19
- mindspore/nn/optim/adasum.py +1 -1
- mindspore/nn/optim/sgd.py +2 -3
- mindspore/nn/probability/distribution/exponential.py +1 -1
- mindspore/nn/probability/distribution/geometric.py +1 -1
- mindspore/nn/probability/distribution/logistic.py +1 -1
- mindspore/nn/wrap/cell_wrapper.py +1 -25
- mindspore/nn/wrap/loss_scale.py +1 -24
- mindspore/numpy/array_ops.py +1 -5
- mindspore/numpy/dtypes.py +3 -3
- mindspore/numpy/math_ops.py +8 -8
- mindspore/ops/__init__.py +1 -1
- mindspore/ops/_grad_experimental/grad_comm_ops.py +16 -75
- mindspore/ops/_vmap/vmap_array_ops.py +0 -27
- mindspore/ops/_vmap/vmap_math_ops.py +1 -29
- mindspore/ops/_vmap/vmap_nn_ops.py +18 -19
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +8 -34
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +9 -2
- mindspore/ops/auto_generate/gen_arg_handler.py +0 -26
- mindspore/ops/auto_generate/gen_extend_func.py +27 -603
- mindspore/ops/auto_generate/gen_ops_def.py +203 -993
- mindspore/ops/auto_generate/gen_ops_prim.py +402 -1946
- mindspore/ops/auto_generate/pyboost_inner_prim.py +20 -90
- mindspore/ops/composite/base.py +6 -3
- mindspore/ops/composite/math_ops.py +1 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +17 -24
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/extend/__init__.py +3 -2
- mindspore/ops/extend/array_func.py +51 -10
- mindspore/ops/extend/nn_func.py +78 -2
- mindspore/ops/function/__init__.py +13 -8
- mindspore/ops/function/array_func.py +179 -455
- mindspore/ops/function/clip_func.py +1 -1
- mindspore/ops/function/grad/grad_func.py +3 -3
- mindspore/ops/function/math_func.py +103 -117
- mindspore/ops/function/nn_func.py +163 -275
- mindspore/ops/function/other_func.py +2 -2
- mindspore/ops/function/random_func.py +69 -202
- mindspore/ops/function/sparse_func.py +4 -4
- mindspore/ops/functional.py +327 -332
- mindspore/ops/operations/__init__.py +3 -13
- mindspore/ops/operations/_grad_ops.py +27 -3
- mindspore/ops/operations/_inner_ops.py +356 -53
- mindspore/ops/operations/_rl_inner_ops.py +2 -2
- mindspore/ops/operations/_tensor_array.py +8 -8
- mindspore/ops/operations/array_ops.py +65 -82
- mindspore/ops/operations/comm_ops.py +93 -784
- mindspore/ops/operations/custom_ops.py +28 -51
- mindspore/ops/operations/debug_ops.py +4 -4
- mindspore/ops/operations/inner_ops.py +2 -2
- mindspore/ops/operations/manually_defined/ops_def.py +4 -304
- mindspore/ops/operations/math_ops.py +50 -3
- mindspore/ops/operations/nn_ops.py +247 -14
- mindspore/ops/operations/other_ops.py +3 -3
- mindspore/ops/operations/random_ops.py +1 -1
- mindspore/ops/operations/sparse_ops.py +1 -1
- mindspore/ops/primitive.py +8 -9
- mindspore/ops/silent_check.py +5 -5
- mindspore/ops_generate/arg_dtype_cast.py +9 -2
- mindspore/ops_generate/arg_handler.py +0 -26
- mindspore/ops_generate/gen_aclnn_implement.py +4 -1
- mindspore/ops_generate/gen_ops.py +4 -26
- mindspore/ops_generate/gen_pyboost_func.py +12 -41
- mindspore/ops_generate/gen_utils.py +0 -21
- mindspore/ops_generate/pyboost_utils.py +2 -7
- mindspore/ops_generate/template.py +0 -1
- mindspore/parallel/_auto_parallel_context.py +1 -21
- mindspore/parallel/_tensor.py +5 -0
- mindspore/parallel/_transformer/transformer.py +1 -1
- mindspore/parallel/_utils.py +1 -15
- mindspore/parallel/algo_parameter_config.py +3 -1
- mindspore/parallel/checkpoint_transform.py +9 -12
- mindspore/parallel/cluster/process_entity/_api.py +29 -28
- mindspore/parallel/cluster/process_entity/_utils.py +3 -13
- mindspore/parallel/cluster/run.py +16 -13
- mindspore/parallel/parameter_broadcast.py +2 -2
- mindspore/parallel/shard.py +17 -31
- mindspore/profiler/__init__.py +2 -3
- mindspore/profiler/common/util.py +2 -107
- mindspore/profiler/envprofiling.py +1 -1
- mindspore/profiler/parser/ascend_analysis/constant.py +21 -8
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -82
- mindspore/profiler/parser/ascend_analysis/function_event.py +28 -43
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +27 -49
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +10 -15
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +20 -25
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +5 -5
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +1 -10
- mindspore/profiler/parser/ascend_hccl_generator.py +1 -4
- mindspore/profiler/parser/ascend_msprof_exporter.py +22 -43
- mindspore/profiler/parser/ascend_timeline_generator.py +5 -7
- mindspore/profiler/parser/minddata_parser.py +3 -72
- mindspore/profiler/profiling.py +59 -176
- mindspore/rewrite/api/node.py +1 -1
- mindspore/rewrite/common/namespace.py +5 -5
- mindspore/rewrite/parsers/assign_parser.py +0 -2
- mindspore/rewrite/parsers/class_def_parser.py +4 -8
- mindspore/run_check/_check_version.py +1 -1
- mindspore/scipy/fft.py +3 -1
- mindspore/scipy/linalg.py +3 -2
- mindspore/scipy/ops.py +3 -5
- mindspore/scipy/optimize/__init__.py +2 -2
- mindspore/train/__init__.py +4 -4
- mindspore/train/anf_ir_pb2.py +2 -8
- mindspore/train/callback/__init__.py +2 -5
- mindspore/train/callback/_backup_and_restore.py +2 -2
- mindspore/train/callback/_checkpoint.py +16 -104
- mindspore/train/callback/_landscape.py +1 -1
- mindspore/train/callback/_time_monitor.py +1 -1
- mindspore/train/data_sink.py +4 -5
- mindspore/train/dataset_helper.py +20 -45
- mindspore/train/model.py +38 -266
- mindspore/train/serialization.py +105 -256
- mindspore/train/summary/_summary_adapter.py +1 -1
- mindspore/version.py +1 -1
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/METADATA +2 -2
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/RECORD +303 -420
- mindspore/_extends/pijit/__init__.py +0 -23
- mindspore/_extends/pijit/pijit_func_white_list.py +0 -343
- mindspore/common/file_system.py +0 -48
- mindspore/common/generator.py +0 -260
- mindspore/common/no_inline.py +0 -54
- mindspore/common/np_dtype.py +0 -25
- mindspore/communication/comm_func.py +0 -1140
- mindspore/hal/memory.py +0 -326
- mindspore/lib/libavcodec.so.59 +0 -0
- mindspore/lib/libavdevice.so.59 +0 -0
- mindspore/lib/libavfilter.so.8 +0 -0
- mindspore/lib/libavformat.so.59 +0 -0
- mindspore/lib/libavutil.so.57 +0 -0
- mindspore/lib/libmindspore_np_dtype.so +0 -0
- mindspore/lib/libswresample.so.4 +0 -0
- mindspore/lib/libswscale.so.6 +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/all_finite.cpp +0 -326
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/all_finite.py +0 -180
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_576ceaeef5870c451cab59af55ea46ad.json +0 -58
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_576ceaeef5870c451cab59af55ea46ad.o +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_86a73ff6e28d734c96bb8d3054f7dd18.json +0 -58
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_86a73ff6e28d734c96bb8d3054f7dd18.o +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_f55e0ebaad1f2f572e43677336992fa0.json +0 -58
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_f55e0ebaad1f2f572e43677336992fa0.o +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/config/ascend910b/all_finite.json +0 -109
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/config/ascend910b/binary_info_config.json +0 -38
- mindspore/lib/plugin/ascend/custom_compiler/OWNERS +0 -12
- mindspore/lib/plugin/ascend/custom_compiler/setup.py +0 -255
- mindspore/lib/plugin/ascend/custom_compiler/start.sh +0 -26
- mindspore/lib/plugin/ascend/custom_compiler/template.json +0 -40
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme.h +0 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme_op.h +0 -69
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/base_type.h +0 -133
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_creator.h +0 -32
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_param.h +0 -35
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/tiling_info.h +0 -60
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/kernel_register.h +0 -37
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/platform_configs.h +0 -89
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/rt_funcs.h +0 -135
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/add_op.h +0 -34
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_backoff_base.h +0 -62
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_elewise_op.h +0 -33
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_ops.h +0 -88
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_pa_op.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/cast_op.h +0 -52
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/matmul_op.h +0 -95
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/asd_utils.h +0 -84
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/comm_utils.h +0 -61
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp32.h +0 -224
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/and_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/div_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_impl.h +0 -48
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_tiling.h +0 -25
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/and_kernel.h +0 -46
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/div_kernel.h +0 -46
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_base.h +0 -260
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_kernel.h +0 -35
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/max_kernel.h +0 -66
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/min_kernel.h +0 -66
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/mul_kernel.h +0 -66
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/or_kernel.h +0 -46
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/max_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/min_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/mul_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/or_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/abs_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_impl.h +0 -47
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_tiling.h +0 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/exp_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/abs_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_base.h +0 -148
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_kernel.h +0 -31
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/exp_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/ln_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/not_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/reciprocal_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/relu_kernel.h +0 -55
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/rsqrt_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/sqrt_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/ln_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/not_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/reciprocal_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/relu_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/rsqrt_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/sqrt_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/grouped_matmul_impl.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/grouped_matmul_tiling.h +0 -187
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul.h +0 -245
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul_interface.h +0 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul_utils.h +0 -111
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/tiling_data.h +0 -54
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/compare_param.h +0 -31
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/elewise_param.h +0 -41
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/grouped_matmul_param.h +0 -40
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/profiling_util.h +0 -364
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_utils.h +0 -69
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_creator.h +0 -39
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_registry.h +0 -114
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/utils.h +0 -98
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix.json +0 -19
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix_mix_aic_0.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix_mix_aiv_0.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix.json +0 -19
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix_mix_aic_0.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix_mix_aiv_0.o +0 -0
- mindspore/mint/linalg/__init__.py +0 -22
- mindspore/nn/layer/embedding_service.py +0 -531
- mindspore/nn/layer/embedding_service_layer.py +0 -393
- mindspore/ops/function/reshard_func.py +0 -102
- mindspore/ops/operations/_infer_ops.py +0 -19
- mindspore/ops/operations/reshard_ops.py +0 -53
- mindspore/profiler/common/process_pool.py +0 -41
- mindspore/profiler/common/singleton.py +0 -28
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/train/callback/_cluster_monitor.py +0 -201
- mindspore/train/callback/_flops_collector.py +0 -238
- mindspore/train/callback/_mindio_ttp.py +0 -443
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/WHEEL +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/entry_points.txt +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/top_level.txt +0 -0
mindspore/__init__.py
CHANGED
|
@@ -20,7 +20,7 @@ from mindspore import common, dataset, mindrecord, train, log, amp
|
|
|
20
20
|
from mindspore import profiler, communication, numpy, parallel, hal
|
|
21
21
|
from mindspore.common import *
|
|
22
22
|
from mindspore.mindrecord import *
|
|
23
|
-
from mindspore.ops import _op_impl, grad, value_and_grad, vjp, jvp, jacfwd, jacrev, vmap, get_grad, constexpr
|
|
23
|
+
from mindspore.ops import _op_impl, grad, value_and_grad, vjp, jvp, jacfwd, jacrev, vmap, get_grad, constexpr
|
|
24
24
|
from mindspore.train import *
|
|
25
25
|
from mindspore.log import *
|
|
26
26
|
from mindspore.context import GRAPH_MODE, PYNATIVE_MODE, set_context, get_context, set_auto_parallel_context, \
|
|
@@ -36,7 +36,6 @@ from mindspore.safeguard import obfuscate_ckpt, load_obf_params_into_net
|
|
|
36
36
|
from mindspore._check_jit_forbidden_api import get_obj_module_and_name_info, is_jit_forbidden_module, \
|
|
37
37
|
is_invalid_or_jit_forbidden_method
|
|
38
38
|
from mindspore import _install_custom
|
|
39
|
-
from mindspore import mint
|
|
40
39
|
from mindspore.ops_generate import arg_dtype_cast, arg_handler
|
|
41
40
|
|
|
42
41
|
__all__ = ["run_check"]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
mindspore/_checkparam.py
CHANGED
|
@@ -1145,8 +1145,21 @@ def check_coo_tensor_dtype(indices_dtype):
|
|
|
1145
1145
|
f"{indices_dtype}.")
|
|
1146
1146
|
|
|
1147
1147
|
|
|
1148
|
+
def check_dynamic_shape(dyn_elem, actual_input, i):
|
|
1149
|
+
"""Check the consistency of dynamic shape tensors and actual input tensors."""
|
|
1150
|
+
if dyn_elem.dtype != actual_input.dtype:
|
|
1151
|
+
raise TypeError(f"The data type of '{i}'th args in actual input tensors should be '{dyn_elem.dtype}', " \
|
|
1152
|
+
f"but got '{actual_input.dtype}'.")
|
|
1153
|
+
if -2 in dyn_elem.shape:
|
|
1154
|
+
return
|
|
1155
|
+
if dyn_elem.ndim != actual_input.ndim:
|
|
1156
|
+
raise ValueError(f"The dimension of '{i}'th args in actual input tensors should be '{dyn_elem.ndim}', " \
|
|
1157
|
+
f"but got '{actual_input.ndim}'.")
|
|
1158
|
+
check_dyn_shape_value_equal(i, dyn_elem.shape, actual_input.shape)
|
|
1159
|
+
|
|
1160
|
+
|
|
1148
1161
|
def check_element_type_of_iterable(arg_name, arg_value, valid_types, prim_name=None):
|
|
1149
|
-
"""Check type of the element of a iterabel object,
|
|
1162
|
+
"""Check type of the element of a iterabel object, execpt dict."""
|
|
1150
1163
|
check_value_type(arg_name, arg_value, [list, tuple], prim_name)
|
|
1151
1164
|
type_names = [t.__name__ if hasattr(t, '__name__') else str(t) for t in valid_types]
|
|
1152
1165
|
num_types = len(valid_types)
|
|
@@ -1186,6 +1199,14 @@ def check_size_and_element_type_of_tuple(arg_name, arg_value, expect_size, expec
|
|
|
1186
1199
|
check_element_type_of_iterable('arg_name', arg_value, [expect_element_type], prim_name)
|
|
1187
1200
|
|
|
1188
1201
|
|
|
1202
|
+
def check_dyn_shape_value_equal(index, dyn_shape, actual_shape):
|
|
1203
|
+
"""Check the consistency of dynamic shape and actual input shape."""
|
|
1204
|
+
for i, x in enumerate(dyn_shape):
|
|
1205
|
+
if x not in (-1, actual_shape[i]):
|
|
1206
|
+
raise ValueError(f"The {i}th shape value of `{index}`th actual input args should be `{x}`, but got " \
|
|
1207
|
+
f"`{actual_shape[i]}`.")
|
|
1208
|
+
|
|
1209
|
+
|
|
1189
1210
|
def _check_symbol(dyn_input, net_input, index, symbolic_shape_data):
|
|
1190
1211
|
"""Check symbolic shape values."""
|
|
1191
1212
|
actual_shape = net_input.shape
|
|
@@ -1196,10 +1217,9 @@ def _check_symbol(dyn_input, net_input, index, symbolic_shape_data):
|
|
|
1196
1217
|
# the value of symbols with same "id" should be equal.
|
|
1197
1218
|
if "id" in sym:
|
|
1198
1219
|
sym_id = sym["id"]
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
unique_id_value = symbolic_shape_data[k_idval]
|
|
1220
|
+
if "unique_id_value" not in symbolic_shape_data:
|
|
1221
|
+
symbolic_shape_data["unique_id_value"] = {}
|
|
1222
|
+
unique_id_value = symbolic_shape_data["unique_id_value"]
|
|
1203
1223
|
if sym_id not in unique_id_value:
|
|
1204
1224
|
unique_id_value[sym_id] = actual_shape[i]
|
|
1205
1225
|
elif unique_id_value[sym_id] != actual_shape[i]:
|
|
@@ -23,7 +23,7 @@ from .parser import (Parser, create_instance, is_supported_create_instance_type,
|
|
|
23
23
|
get_ast_type, get_node_type, get_args, get_args_default_values, get_ast_namespace_symbol,
|
|
24
24
|
get_operation_symbol, get_operation_namespace_symbol, get_parse_method_of_class, get_scope_name,
|
|
25
25
|
eval_script, get_script_id_attrs, expand_expr_statement, is_class_member_of_self, parse_cb,
|
|
26
|
-
convert_to_ms_tensor, get_object_description, get_ms_class_name,
|
|
26
|
+
convert_to_ms_tensor, get_object_description, get_ms_class_name,
|
|
27
27
|
is_class_type, check_obj_bool, python_isinstance, ms_isinstance, convert_to_ms_csrtensor,
|
|
28
28
|
convert_to_ms_cootensor, convert_class_to_function, convert_cell_list_to_sequence, is_cell_list,
|
|
29
29
|
get_obj_from_sequence, get_type, is_class_member_recursive, get_global_params,
|
|
@@ -38,7 +38,7 @@ __all__ = ['Parser', 'create_instance', 'is_supported_create_instance_type', 'ge
|
|
|
38
38
|
'get_ast_type', 'get_node_type', 'get_args', 'get_args_default_values', 'get_ast_namespace_symbol',
|
|
39
39
|
'get_operation_symbol', 'get_operation_namespace_symbol', 'get_parse_method_of_class', 'get_scope_name',
|
|
40
40
|
'eval_script', 'get_script_id_attrs', 'expand_expr_statement', 'is_class_member_of_self', 'parse_cb',
|
|
41
|
-
'resolve_symbol', 'convert_to_ms_tensor', 'get_object_description',
|
|
41
|
+
'resolve_symbol', 'convert_to_ms_tensor', 'get_object_description',
|
|
42
42
|
'get_ms_class_name', 'is_class_type', 'check_obj_bool', 'python_isinstance', 'ms_isinstance',
|
|
43
43
|
'convert_to_ms_csrtensor', 'convert_to_ms_cootensor', 'convert_class_to_function',
|
|
44
44
|
'convert_cell_list_to_sequence', 'is_cell_list', 'get_obj_from_sequence', 'get_type',
|
|
@@ -203,32 +203,6 @@ Value Range:
|
|
|
203
203
|
"""
|
|
204
204
|
TRACE_LABEL_WITH_UNIQUE_ID = ''
|
|
205
205
|
|
|
206
|
-
"""
|
|
207
|
-
Name: DUMP_IR_DDE_DETAIL
|
|
208
|
-
Function: When generating IR files, whether to print DDE node detail.
|
|
209
|
-
Value Range:
|
|
210
|
-
1: Print DDE node detail.
|
|
211
|
-
Default: Only print used flags.
|
|
212
|
-
"""
|
|
213
|
-
DUMP_IR_DDE_DETAIL = ''
|
|
214
|
-
|
|
215
|
-
"""
|
|
216
|
-
Name: COMBINE_LIKE_GRAPHS
|
|
217
|
-
Function: Whether to combine the func_graphs which have the same object key according to the @cell_attr_register.
|
|
218
|
-
Value Range:
|
|
219
|
-
0: Disable
|
|
220
|
-
Default: Enable.
|
|
221
|
-
"""
|
|
222
|
-
COMBINE_LIKE_GRAPHS = ''
|
|
223
|
-
|
|
224
|
-
"""
|
|
225
|
-
Name: DUMP_VALIDATE_BEFORE_RESET_ID
|
|
226
|
-
Function: Whether to dump validate ir before reset id.
|
|
227
|
-
Value Range:
|
|
228
|
-
1: Enable
|
|
229
|
-
Default: Disable.
|
|
230
|
-
"""
|
|
231
|
-
DUMP_VALIDATE_BEFORE_RESET_ID = ''
|
|
232
206
|
|
|
233
207
|
__all__ = [
|
|
234
208
|
"COMPILE_PROFILE",
|
|
@@ -252,7 +226,4 @@ __all__ = [
|
|
|
252
226
|
"ENABLE_FIX_CODE_LINE",
|
|
253
227
|
"RECORD_MEMORY",
|
|
254
228
|
"TRACE_LABEL_WITH_UNIQUE_ID",
|
|
255
|
-
"DUMP_IR_DDE_DETAIL",
|
|
256
|
-
"COMBINE_LIKE_GRAPHS",
|
|
257
|
-
"DUMP_VALIDATE_BEFORE_RESET_ID",
|
|
258
229
|
]
|
|
@@ -51,9 +51,9 @@ class Namespace:
|
|
|
51
51
|
return f'Namespace:{self.name}'
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
class
|
|
54
|
+
class CellNamespace(Namespace):
|
|
55
55
|
"""
|
|
56
|
-
Namespace for
|
|
56
|
+
Namespace for Cell object.
|
|
57
57
|
|
|
58
58
|
Args:
|
|
59
59
|
name (str): Valid module name, it can be imported.
|
|
@@ -45,7 +45,7 @@ from mindspore.common.parameter import Parameter
|
|
|
45
45
|
from mindspore.common import mutable
|
|
46
46
|
from mindspore.common._register_for_adapter import ms_adapter_registry
|
|
47
47
|
from mindspore._checkparam import is_stub_tensor
|
|
48
|
-
from .namespace import Namespace,
|
|
48
|
+
from .namespace import Namespace, CellNamespace, ClosureNamespace, ClassMemberNamespace
|
|
49
49
|
from .resources import parse_object_map, ops_symbol_map, convert_object_map, convert_class_to_function_map, trope_ns
|
|
50
50
|
from .resources import SYMBOL_UNDEFINE, constant_fold_functions
|
|
51
51
|
from ...common.api import _convert_python_data
|
|
@@ -546,7 +546,7 @@ def get_module_namespace(obj):
|
|
|
546
546
|
logger.debug("get module namespace, module: %r", obj)
|
|
547
547
|
mod_namespace = None
|
|
548
548
|
if isinstance(obj, types.ModuleType):
|
|
549
|
-
mod_namespace =
|
|
549
|
+
mod_namespace = CellNamespace(obj.__name__)
|
|
550
550
|
else:
|
|
551
551
|
logger.warning("Module(%r) is invalid, get namespace failure!", obj)
|
|
552
552
|
return mod_namespace
|
|
@@ -795,21 +795,6 @@ def get_args(node):
|
|
|
795
795
|
return args
|
|
796
796
|
|
|
797
797
|
|
|
798
|
-
def get_arg_spec_and_default_values(func):
|
|
799
|
-
"""Get the full arg specification and the default arg values of a function"""
|
|
800
|
-
arg_spec = inspect.getfullargspec(func)
|
|
801
|
-
defaults = {}
|
|
802
|
-
args_len = len(arg_spec.args)
|
|
803
|
-
if arg_spec.defaults:
|
|
804
|
-
defaults_len = len(arg_spec.defaults)
|
|
805
|
-
for i in range(defaults_len):
|
|
806
|
-
defaults[arg_spec.args[args_len - i - 1]] = arg_spec.defaults[defaults_len - i - 1]
|
|
807
|
-
if arg_spec.kwonlydefaults:
|
|
808
|
-
for k, v in arg_spec.kwonlydefaults.items():
|
|
809
|
-
defaults[k] = v
|
|
810
|
-
return arg_spec, defaults
|
|
811
|
-
|
|
812
|
-
|
|
813
798
|
def _convert_stub_tensor(data):
|
|
814
799
|
"""Convert stub tensor output to tensor"""
|
|
815
800
|
if is_stub_tensor(data):
|
|
@@ -1072,10 +1057,9 @@ def get_method_info(obj):
|
|
|
1072
1057
|
|
|
1073
1058
|
def is_ms_tensor_method(obj):
|
|
1074
1059
|
"""Check if the obj is a method of MindSpore Tensor"""
|
|
1075
|
-
if not hasattr(obj,
|
|
1060
|
+
if not hasattr(obj, "__self__"):
|
|
1076
1061
|
return False
|
|
1077
|
-
|
|
1078
|
-
return fn == getattr(Tensor, obj.__name__)
|
|
1062
|
+
return type(obj.__self__) == Tensor
|
|
1079
1063
|
|
|
1080
1064
|
|
|
1081
1065
|
def can_constant_fold(obj):
|
|
@@ -1101,7 +1085,7 @@ class Parser:
|
|
|
1101
1085
|
self.filename: str = self.fn.__code__.co_filename
|
|
1102
1086
|
|
|
1103
1087
|
# Used to resolve the function's globals namespace.
|
|
1104
|
-
self.global_namespace =
|
|
1088
|
+
self.global_namespace = CellNamespace(self.fn.__module__)
|
|
1105
1089
|
self.global_namespace.dicts[0]["__ms_tensor_func__"] = tensor
|
|
1106
1090
|
|
|
1107
1091
|
self.function_module = self.fn.__module__
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This is the Python adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/).
|
|
2
2
|
#
|
|
3
|
-
# Copyright 2020-
|
|
3
|
+
# Copyright 2020-2023 Huawei Technologies Co., Ltd
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
# you may not use this file except in compliance with the License.
|
|
@@ -28,12 +28,12 @@ from mindspore.ops.composite import multitype_ops
|
|
|
28
28
|
from mindspore._c_expression import security
|
|
29
29
|
from . import standard_method as M
|
|
30
30
|
from . import trope as T
|
|
31
|
-
from .namespace import
|
|
31
|
+
from .namespace import CellNamespace
|
|
32
32
|
|
|
33
33
|
# namespace define
|
|
34
|
-
functional_ns =
|
|
35
|
-
composite_ns =
|
|
36
|
-
trope_ns =
|
|
34
|
+
functional_ns = CellNamespace('mindspore.ops.functional')
|
|
35
|
+
composite_ns = CellNamespace('mindspore.ops.composite')
|
|
36
|
+
trope_ns = CellNamespace('mindspore._extends.parse.trope')
|
|
37
37
|
|
|
38
38
|
SYMBOL_UNDEFINE = 0xFF # Undefined var and function
|
|
39
39
|
|
|
@@ -171,6 +171,8 @@ if not security.enable_security():
|
|
|
171
171
|
|
|
172
172
|
# Convert class object to callable function
|
|
173
173
|
convert_class_to_function_map = {
|
|
174
|
+
"class 'list'": M.list_func,
|
|
175
|
+
"class 'tuple'": M.tuple_func,
|
|
174
176
|
"class 'int'": M.int_func,
|
|
175
177
|
"class 'float'": M.float_func,
|
|
176
178
|
"class 'bool'": M.bool_func,
|
|
@@ -20,12 +20,12 @@ from __future__ import absolute_import
|
|
|
20
20
|
from mindspore import Tensor, CSRTensor, COOTensor
|
|
21
21
|
from mindspore import dtype as mstype
|
|
22
22
|
from mindspore._c_expression import Tensor as Tensor_
|
|
23
|
-
from mindspore.common import mutable
|
|
24
23
|
import mindspore.common._monad as monad
|
|
25
24
|
from mindspore.common.sparse_tensor import RowTensorInner
|
|
26
25
|
from mindspore.ops.composite.base import _append, _insert, _pop, _list_clear, _reverse, \
|
|
27
26
|
_extend, _dict_setitem, _dict_clear, _haskey, _update, _fromkeys
|
|
28
27
|
from mindspore.ops.operations._sequence_ops import TensorToTuple
|
|
28
|
+
from mindspore.ops_generate.gen_ops_inner_prim import ListToTuple, TupleToList
|
|
29
29
|
|
|
30
30
|
from ... import _checkparam as validator
|
|
31
31
|
from ..._checkparam import check_is_number, check_reshape_shp, check_axis_in_range, \
|
|
@@ -1812,24 +1812,39 @@ def searchsorted(x, v, side='left', sorter=None):
|
|
|
1812
1812
|
2
|
|
1813
1813
|
"""
|
|
1814
1814
|
|
|
1815
|
+
def get_log2_size(size):
|
|
1816
|
+
"""Get log2 size"""
|
|
1817
|
+
log2_res = F.log2(F.cast(size, mstype.float32))
|
|
1818
|
+
ceil_res = F.ceil(log2_res)
|
|
1819
|
+
cast_res = F.cast(ceil_res, mstype.int64)
|
|
1820
|
+
return cast_res
|
|
1821
|
+
|
|
1815
1822
|
if side not in ('left', 'right'):
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
if not
|
|
1823
|
+
const_utils.raise_value_error('invalid value for keyword "side"')
|
|
1824
|
+
a = x.astype(mstype.float32)
|
|
1825
|
+
if not check_is_tensor(F.typeof(v)):
|
|
1819
1826
|
v = const_utils.make_tensor(v)
|
|
1827
|
+
shape = v.shape
|
|
1820
1828
|
if sorter is not None:
|
|
1821
|
-
if
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1829
|
+
if sorter.ndim != 1 or sorter.size != a.size:
|
|
1830
|
+
const_utils.raise_value_error(
|
|
1831
|
+
'sorter must be 1-D array with the same size as `a`')
|
|
1832
|
+
sorter = const_utils.make_tensor(sorter)
|
|
1833
|
+
sorter = sorter.reshape(sorter.shape + (1,))
|
|
1834
|
+
a = F.gather_nd(a, sorter)
|
|
1835
|
+
less_op = F.tensor_le if side == 'left' else F.tensor_lt
|
|
1836
|
+
i = F.fill(mstype.int32, shape, 0)
|
|
1837
|
+
j = F.fill(mstype.int32, shape, a.size)
|
|
1838
|
+
|
|
1839
|
+
loop_num = get_log2_size(F.shape_mul(a.shape) + 1)
|
|
1840
|
+
index = Tensor([0])
|
|
1841
|
+
while index < loop_num:
|
|
1842
|
+
mid = (i - F.neg(j)) // 2
|
|
1843
|
+
mask = less_op(v, F.gather_nd(a, mid.reshape(mid.shape + (1,))))
|
|
1844
|
+
i = F.select(mask, i, mid)
|
|
1845
|
+
j = F.select(mask, mid, j)
|
|
1846
|
+
index += 1
|
|
1847
|
+
return j
|
|
1833
1848
|
|
|
1834
1849
|
|
|
1835
1850
|
def fill(x, value):
|
|
@@ -2418,35 +2433,46 @@ def float_func(*data):
|
|
|
2418
2433
|
return cast_to_float(data)
|
|
2419
2434
|
|
|
2420
2435
|
|
|
2421
|
-
def list_func(data):
|
|
2436
|
+
def list_func(*data):
|
|
2422
2437
|
"""Implementation of `list`."""
|
|
2438
|
+
data_len = len(data)
|
|
2439
|
+
if data_len >= 2:
|
|
2440
|
+
const_utils.raise_type_error("list() requires 0 or 1 arguments.")
|
|
2441
|
+
if data_len == 0:
|
|
2442
|
+
return F.make_list()
|
|
2443
|
+
data = data[0]
|
|
2444
|
+
if isinstance(data, list):
|
|
2445
|
+
return data
|
|
2446
|
+
if isinstance(data, tuple):
|
|
2447
|
+
return TupleToList()(data)
|
|
2423
2448
|
if isinstance(data, (CSRTensor, COOTensor, RowTensorInner)):
|
|
2424
|
-
|
|
2449
|
+
const_utils.raise_type_error(
|
|
2425
2450
|
"list() does not support single sparse tensor input.")
|
|
2426
2451
|
if isinstance(data, dict):
|
|
2427
2452
|
data = data.keys()
|
|
2428
|
-
|
|
2429
|
-
ret = mutable([], True)
|
|
2430
|
-
if F.is_dynamic_sequence_element_unknown(data):
|
|
2431
|
-
return ret
|
|
2432
|
-
else:
|
|
2433
|
-
ret = F.make_list()
|
|
2453
|
+
ret = F.make_list()
|
|
2434
2454
|
for i in data:
|
|
2435
2455
|
ret = ret + F.make_list(i)
|
|
2436
2456
|
return ret
|
|
2437
2457
|
|
|
2438
|
-
|
|
2458
|
+
|
|
2459
|
+
def tuple_func(*data):
|
|
2439
2460
|
"""Implementation of `tuple`."""
|
|
2461
|
+
data_len = len(data)
|
|
2462
|
+
if data_len >= 2:
|
|
2463
|
+
raise TypeError("tuple() requires 0 or 1 arguments.")
|
|
2464
|
+
if data_len == 0:
|
|
2465
|
+
return F.make_tuple()
|
|
2466
|
+
data = data[0]
|
|
2467
|
+
if isinstance(data, tuple):
|
|
2468
|
+
return data
|
|
2469
|
+
if isinstance(data, list):
|
|
2470
|
+
return ListToTuple()(data)
|
|
2440
2471
|
if isinstance(data, (CSRTensor, COOTensor, RowTensorInner)):
|
|
2441
2472
|
raise TypeError("tuple() does not support single sparse tensor input.")
|
|
2442
2473
|
if isinstance(data, dict):
|
|
2443
2474
|
data = data.keys()
|
|
2444
|
-
|
|
2445
|
-
ret = mutable((), True)
|
|
2446
|
-
if F.is_dynamic_sequence_element_unknown(data):
|
|
2447
|
-
return ret
|
|
2448
|
-
else:
|
|
2449
|
-
ret = F.make_tuple()
|
|
2475
|
+
ret = F.make_tuple()
|
|
2450
2476
|
for i in data:
|
|
2451
2477
|
ret = ret + F.make_tuple(i)
|
|
2452
2478
|
return ret
|
|
@@ -3052,11 +3078,11 @@ def negative(input):
|
|
|
3052
3078
|
return F.neg(input)
|
|
3053
3079
|
|
|
3054
3080
|
|
|
3055
|
-
def nonzero(input
|
|
3081
|
+
def nonzero(input):
|
|
3056
3082
|
"""
|
|
3057
3083
|
Return a Tensor of the positions of all non-zero values.
|
|
3058
3084
|
"""
|
|
3059
|
-
return F.nonzero(input
|
|
3085
|
+
return F.nonzero(input)
|
|
3060
3086
|
|
|
3061
3087
|
|
|
3062
3088
|
def new_zeros(x, size, *, dtype=None):
|
|
@@ -4353,13 +4379,6 @@ def amax(input, axis=None, keep_dims=False):
|
|
|
4353
4379
|
return F.amax(input, axis, keep_dims)
|
|
4354
4380
|
|
|
4355
4381
|
|
|
4356
|
-
def uniform(input, from_=0., to=1., generator=None):
|
|
4357
|
-
r"""
|
|
4358
|
-
Generates random numbers in the half-open interval [from_, to).
|
|
4359
|
-
"""
|
|
4360
|
-
return F.uniform_ext(input, from_, to, generator)
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
4382
|
def amin(input, axis=None, keep_dims=False):
|
|
4364
4383
|
r"""
|
|
4365
4384
|
For details, please refer to :func:`mindspore.ops.amin`.
|
|
Binary file
|
mindspore/amp.py
CHANGED
|
@@ -20,7 +20,6 @@ from abc import ABC, abstractmethod
|
|
|
20
20
|
from mindspore.common import mutable
|
|
21
21
|
from mindspore.ops._primitive_cache import _get_cache_prim
|
|
22
22
|
from mindspore.ops.operations.math_ops import NPUGetFloatStatusV2, NPUClearFloatStatusV2
|
|
23
|
-
from mindspore.ops.operations.nn_ops import AllFinite
|
|
24
23
|
from mindspore import _checkparam as validator
|
|
25
24
|
from mindspore._c_expression import MSContext
|
|
26
25
|
from .common import dtype as mstype
|
|
@@ -59,22 +58,6 @@ def _gpu_target():
|
|
|
59
58
|
return context.get_context("device_target") == "GPU"
|
|
60
59
|
|
|
61
60
|
|
|
62
|
-
@constexpr
|
|
63
|
-
def _enable_all_finite():
|
|
64
|
-
"""check whether enable all finite"""
|
|
65
|
-
runtime_conf = os.environ.get('MS_DEV_RUNTIME_CONF')
|
|
66
|
-
global_jit_config = context.get_jit_config()
|
|
67
|
-
if runtime_conf is not None and ("all_finite:True" in runtime_conf or "all_finite:true" in runtime_conf):
|
|
68
|
-
return True
|
|
69
|
-
|
|
70
|
-
if runtime_conf is not None and ("all_finite:False" in runtime_conf or "all_finite:false" in runtime_conf):
|
|
71
|
-
return False
|
|
72
|
-
|
|
73
|
-
if global_jit_config:
|
|
74
|
-
return global_jit_config["jit_level"] == "O0" or global_jit_config["jit_level"] == "O1"
|
|
75
|
-
return False
|
|
76
|
-
|
|
77
|
-
|
|
78
61
|
def _grad_unscale(scale, grad):
|
|
79
62
|
return grad * ops.Reciprocal()(scale).astype(grad.dtype)
|
|
80
63
|
|
|
@@ -101,7 +84,7 @@ def _overflow(inputs):
|
|
|
101
84
|
|
|
102
85
|
|
|
103
86
|
@jit
|
|
104
|
-
def _all_finite(inputs, check_overflow_mode
|
|
87
|
+
def _all_finite(inputs, check_overflow_mode):
|
|
105
88
|
"""all finite check"""
|
|
106
89
|
if _ascend_target():
|
|
107
90
|
if (_ascend_910a_target()) or \
|
|
@@ -115,13 +98,9 @@ def _all_finite(inputs, check_overflow_mode, enable_allfinite):
|
|
|
115
98
|
status_finite = get_status.equal(Tensor(0, mstype.int32)).all()
|
|
116
99
|
return status_finite
|
|
117
100
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
else:
|
|
122
|
-
outputs = _hypermap(_partial(_overflow), inputs)
|
|
123
|
-
flag_sum = ops.addn(outputs).reshape(())
|
|
124
|
-
status_finite = ops.less(flag_sum, 1)
|
|
101
|
+
outputs = _hypermap(_partial(_overflow), inputs)
|
|
102
|
+
flag_sum = ops.addn(outputs).reshape(())
|
|
103
|
+
status_finite = ops.less(flag_sum, 1)
|
|
125
104
|
return status_finite
|
|
126
105
|
|
|
127
106
|
|
|
@@ -157,7 +136,7 @@ def all_finite(inputs):
|
|
|
157
136
|
"""
|
|
158
137
|
inputs = mutable(inputs)
|
|
159
138
|
_check_overflow_mode = os.environ.get('MS_ASCEND_CHECK_OVERFLOW_MODE')
|
|
160
|
-
return _all_finite(inputs, _check_overflow_mode
|
|
139
|
+
return _all_finite(inputs, _check_overflow_mode)
|
|
161
140
|
|
|
162
141
|
|
|
163
142
|
@jit_class
|
mindspore/bin/cache_admin
CHANGED
|
Binary file
|
mindspore/bin/cache_server
CHANGED
|
Binary file
|
mindspore/boost/adasum.py
CHANGED
|
@@ -23,7 +23,7 @@ from mindspore.communication.management import create_group
|
|
|
23
23
|
from mindspore.ops import composite as C
|
|
24
24
|
from mindspore.ops import functional as F
|
|
25
25
|
from mindspore.ops import operations as P
|
|
26
|
-
from mindspore.ops import Send, Receive
|
|
26
|
+
from mindspore.ops.operations._inner_ops import Send, Receive
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
__all__ = ["AdaSum"]
|
mindspore/boost/base.py
CHANGED
|
@@ -183,7 +183,7 @@ class ParameterProcess:
|
|
|
183
183
|
Examples:
|
|
184
184
|
>>> import numpy as np
|
|
185
185
|
>>> from mindspore import Tensor, Parameter, nn
|
|
186
|
-
>>>
|
|
186
|
+
>>> import mindspore.ops as ops
|
|
187
187
|
>>> from mindspore.boost import ParameterProcess
|
|
188
188
|
>>>
|
|
189
189
|
>>> class Net(nn.Cell):
|
|
@@ -435,7 +435,7 @@ class BoostTrainOneStepWithLossScaleCell(BoostTrainOneStepCell):
|
|
|
435
435
|
Examples:
|
|
436
436
|
>>> import numpy as np
|
|
437
437
|
>>> from mindspore import Tensor, Parameter, nn
|
|
438
|
-
>>>
|
|
438
|
+
>>> import mindspore.ops as ops
|
|
439
439
|
>>> from mindspore.nn import WithLossCell
|
|
440
440
|
>>> from mindspore import dtype as mstype
|
|
441
441
|
>>> from mindspore import boost
|
mindspore/boost/grad_freeze.py
CHANGED
|
@@ -206,7 +206,7 @@ class GradientFreeze:
|
|
|
206
206
|
Examples:
|
|
207
207
|
>>> import numpy as np
|
|
208
208
|
>>> from mindspore import Tensor, Parameter, nn
|
|
209
|
-
>>>
|
|
209
|
+
>>> import mindspore.ops as ops
|
|
210
210
|
>>> from mindspore.nn import WithLossCell
|
|
211
211
|
>>> from mindspore import dtype as mstype
|
|
212
212
|
>>> from mindspore import boost
|
|
@@ -347,7 +347,7 @@ def freeze_cell(reducer_flag, network, optimizer, sens, grad, use_grad_accumulat
|
|
|
347
347
|
Examples:
|
|
348
348
|
>>> import numpy as np
|
|
349
349
|
>>> from mindspore import Tensor, Parameter, nn
|
|
350
|
-
>>>
|
|
350
|
+
>>> import mindspore.ops as ops
|
|
351
351
|
>>> from mindspore.boost.grad_freeze import freeze_cell, FreezeOpt
|
|
352
352
|
>>>
|
|
353
353
|
>>> class Net(nn.Cell):
|
|
@@ -96,7 +96,7 @@ class LessBN(Cell):
|
|
|
96
96
|
Examples:
|
|
97
97
|
>>> import numpy as np
|
|
98
98
|
>>> from mindspore import Tensor, Parameter, nn
|
|
99
|
-
>>>
|
|
99
|
+
>>> import mindspore.ops as ops
|
|
100
100
|
>>> from mindspore.nn import WithLossCell
|
|
101
101
|
>>> from mindspore import dtype as mstype
|
|
102
102
|
>>> from mindspore import boost
|
|
@@ -125,14 +125,11 @@ class LessBN(Cell):
|
|
|
125
125
|
def __init__(self, network, fn_flag=False):
|
|
126
126
|
super(LessBN, self).__init__()
|
|
127
127
|
self.network = network
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
# Please use this interface with caution as it may cause uncontrollable problem.
|
|
134
|
-
# The purpose here is to prevent the "less_bn" flag from disappearing.
|
|
135
|
-
self.network.add_flags(defer_inline=True)
|
|
128
|
+
self.network.set_boost("less_bn")
|
|
129
|
+
self.network.update_cell_prefix()
|
|
130
|
+
if fn_flag:
|
|
131
|
+
self._convert_to_less_bn_net(self.network)
|
|
132
|
+
self.network.add_flags(defer_inline=True)
|
|
136
133
|
|
|
137
134
|
@staticmethod
|
|
138
135
|
def _convert_dense(subcell):
|
mindspore/common/__init__.py
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"""Top-level reference to dtype of common module."""
|
|
16
16
|
from __future__ import absolute_import
|
|
17
17
|
from mindspore.common import dtype
|
|
18
|
-
from mindspore.common.api import ms_function, ms_memory_recycle, ms_class, jit, jit_class, _no_grad
|
|
18
|
+
from mindspore.common.api import ms_function, ms_memory_recycle, ms_class, jit, jit_class, _no_grad
|
|
19
19
|
from mindspore.common.dtype import Type, int8, byte, int16, short, int32, intc, int64, intp, \
|
|
20
20
|
uint8, ubyte, uint16, ushort, uint32, uintc, uint64, uintp, float16, half, \
|
|
21
21
|
float32, single, float64, bfloat16, double, bool_, float_, list_, tuple_, int_, \
|
|
@@ -30,13 +30,9 @@ from mindspore.common.sparse_tensor import RowTensor, RowTensorInner, SparseTens
|
|
|
30
30
|
from mindspore.common.mutable import mutable
|
|
31
31
|
from mindspore.common.jit_config import JitConfig
|
|
32
32
|
from mindspore.common.lazy_inline import lazy_inline
|
|
33
|
-
from mindspore.common.no_inline import no_inline
|
|
34
33
|
from mindspore.common.mindir_util import load_mindir, save_mindir
|
|
35
34
|
from mindspore.common.symbol import Symbol
|
|
36
35
|
from mindspore.common.recompute import recompute
|
|
37
|
-
from mindspore.common import generator
|
|
38
|
-
from mindspore.common.generator import (
|
|
39
|
-
Generator, default_generator, seed, manual_seed, initial_seed, get_rng_state, set_rng_state)
|
|
40
36
|
|
|
41
37
|
# symbols from dtype
|
|
42
38
|
__all__ = [
|
|
@@ -75,10 +71,7 @@ __all__.extend([
|
|
|
75
71
|
"set_dump",
|
|
76
72
|
"ms_memory_recycle",
|
|
77
73
|
"mutable", "JitConfig",
|
|
78
|
-
"flops_collection",
|
|
79
74
|
"lazy_inline", "load_mindir", "save_mindir",
|
|
80
|
-
"no_inline",
|
|
81
75
|
"Symbol",
|
|
82
76
|
"recompute"
|
|
83
77
|
])
|
|
84
|
-
__all__.extend(generator.__all__)
|
|
@@ -16,29 +16,30 @@
|
|
|
16
16
|
"""Registry the relation."""
|
|
17
17
|
|
|
18
18
|
from __future__ import absolute_import
|
|
19
|
+
from collections import UserDict
|
|
19
20
|
from mindspore._c_expression import Tensor as Tensor_
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
class Registry:
|
|
23
|
-
"""
|
|
23
|
+
class Registry(UserDict):
|
|
24
|
+
"""Registry class for registry functions for tensor call primitive ops function."""
|
|
24
25
|
|
|
25
|
-
def
|
|
26
|
-
|
|
26
|
+
def register(self, obj_str, obj):
|
|
27
|
+
if isinstance(obj_str, str):
|
|
28
|
+
self[obj_str] = obj
|
|
27
29
|
|
|
28
30
|
def get(self, obj_str):
|
|
29
|
-
"""Get
|
|
30
|
-
|
|
31
|
+
"""Get the value by str."""
|
|
31
32
|
if not isinstance(obj_str, str):
|
|
32
33
|
raise TypeError("key for tensor registry must be string.")
|
|
33
34
|
if Tensor_._is_test_stub() is True: # pylint: disable=W0212
|
|
34
35
|
def wrap(*args):
|
|
35
36
|
new_args = list(args)
|
|
36
37
|
new_args.append(obj_str)
|
|
37
|
-
return
|
|
38
|
+
return self["vm_compare"](*new_args)
|
|
38
39
|
|
|
39
40
|
obj = wrap
|
|
40
41
|
else:
|
|
41
|
-
obj =
|
|
42
|
+
obj = self[obj_str]
|
|
42
43
|
return obj
|
|
43
44
|
|
|
44
45
|
|