mindspore 2.6.0rc1__cp311-cp311-win_amd64.whl → 2.7.0__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +2 -2
- mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +42 -11
- mindspore/_extends/builtin_operations.py +3 -3
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -2
- mindspore/_extends/parse/parser.py +65 -84
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +58 -14
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/_extends/pijit/pijit_func_white_list.py +2 -5
- mindspore/amp.py +4 -22
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +4 -4
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +43 -12
- mindspore/common/_grad_function.py +2 -1
- mindspore/common/_pijit_context.py +28 -7
- mindspore/common/_stub_tensor.py +1 -209
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +178 -53
- mindspore/common/_utils.py +9 -1
- mindspore/common/api.py +377 -203
- mindspore/common/dtype.py +108 -57
- mindspore/common/dump.py +11 -16
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +17 -23
- mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
- mindspore/common/file_system.py +59 -9
- mindspore/common/generator.py +5 -3
- mindspore/common/hook_handle.py +33 -5
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +27 -29
- mindspore/common/recompute.py +5 -7
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +117 -131
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +67 -55
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +38 -4
- mindspore/dataset/engine/datasets.py +350 -322
- mindspore/dataset/engine/datasets_user_defined.py +70 -24
- mindspore/dataset/engine/iterators.py +2 -2
- mindspore/dataset/engine/obs/config_loader.py +2 -2
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +10 -6
- mindspore/dataset/vision/__init__.py +1 -1
- mindspore/dataset/vision/py_transforms.py +8 -8
- mindspore/dataset/vision/transforms.py +17 -5
- mindspore/dataset/vision/utils.py +632 -21
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -1
- mindspore/device_context/ascend/op_tuning.py +35 -1
- mindspore/device_context/gpu/__init__.py +2 -2
- mindspore/device_context/gpu/device.py +1 -1
- mindspore/device_context/gpu/op_precision.py +4 -2
- mindspore/device_context/gpu/op_tuning.py +6 -3
- mindspore/device_manager.py +16 -9
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +3 -4
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/optim/adadelta.py +13 -20
- mindspore/experimental/optim/adagrad.py +15 -22
- mindspore/experimental/optim/adam.py +17 -24
- mindspore/experimental/optim/adamax.py +14 -22
- mindspore/experimental/optim/adamw.py +28 -34
- mindspore/experimental/optim/asgd.py +15 -25
- mindspore/experimental/optim/lr_scheduler.py +27 -45
- mindspore/experimental/optim/nadam.py +14 -24
- mindspore/experimental/optim/optimizer.py +13 -23
- mindspore/experimental/optim/radam.py +18 -24
- mindspore/experimental/optim/rmsprop.py +14 -25
- mindspore/experimental/optim/rprop.py +15 -26
- mindspore/experimental/optim/sgd.py +9 -19
- mindspore/hal/__init__.py +4 -4
- mindspore/hal/contiguous_tensors_handle.py +2 -2
- mindspore/hal/memory.py +27 -7
- mindspore/include/api/cell.h +65 -5
- mindspore/include/api/cfg.h +24 -7
- mindspore/include/api/context.h +1 -0
- mindspore/include/api/delegate.h +10 -2
- mindspore/include/api/dual_abi_helper.h +100 -19
- mindspore/include/api/graph.h +14 -1
- mindspore/include/api/kernel.h +16 -3
- mindspore/include/api/kernel_api.h +9 -1
- mindspore/include/api/metrics/accuracy.h +9 -0
- mindspore/include/api/model.h +8 -1
- mindspore/include/api/model_group.h +4 -0
- mindspore/include/api/model_parallel_runner.h +2 -0
- mindspore/include/api/status.h +48 -10
- mindspore/include/api/types.h +8 -3
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/constants.h +9 -0
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +61 -11
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mindspore_ops_host.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +6 -46
- mindspore/mint/distributed/__init__.py +5 -0
- mindspore/mint/distributed/distributed.py +429 -23
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +163 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +140 -104
- mindspore/mint/nn/layer/normalization.py +11 -25
- mindspore/mint/optim/adam.py +19 -18
- mindspore/mint/optim/adamw.py +14 -8
- mindspore/mint/optim/sgd.py +5 -5
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/nn/cell.py +491 -623
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +36 -36
- mindspore/nn/layer/basic.py +74 -77
- mindspore/nn/layer/channel_shuffle.py +4 -4
- mindspore/nn/layer/combined.py +4 -2
- mindspore/nn/layer/conv.py +117 -110
- mindspore/nn/layer/dense.py +9 -7
- mindspore/nn/layer/embedding.py +50 -52
- mindspore/nn/layer/image.py +38 -40
- mindspore/nn/layer/math.py +111 -112
- mindspore/nn/layer/normalization.py +56 -44
- mindspore/nn/layer/pooling.py +58 -63
- mindspore/nn/layer/rnn_cells.py +33 -33
- mindspore/nn/layer/rnns.py +56 -56
- mindspore/nn/layer/thor_layer.py +74 -73
- mindspore/nn/layer/transformer.py +11 -1
- mindspore/nn/learning_rate_schedule.py +20 -20
- mindspore/nn/loss/loss.py +79 -81
- mindspore/nn/optim/adam.py +4 -6
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/asgd.py +2 -0
- mindspore/nn/optim/lamb.py +1 -3
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/tft_wrapper.py +2 -3
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -1
- mindspore/nn/probability/distribution/poisson.py +2 -1
- mindspore/nn/sparse/sparse.py +3 -3
- mindspore/nn/wrap/cell_wrapper.py +73 -42
- mindspore/nn/wrap/grad_reducer.py +37 -52
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +7 -7
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.py +5 -5
- mindspore/numpy/utils_const.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
- mindspore/ops/_op_impl/cpu/__init__.py +1 -0
- mindspore/{experimental/es/__init__.py → ops/_op_impl/cpu/joinedstr_op.py} +12 -6
- mindspore/ops/_vmap/vmap_array_ops.py +31 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +54 -13
- mindspore/ops/auto_generate/gen_extend_func.py +27 -145
- mindspore/ops/auto_generate/gen_ops_def.py +1027 -347
- mindspore/ops/auto_generate/gen_ops_prim.py +2341 -1117
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +9 -5
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +133 -109
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
- mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
- mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
- mindspore/ops/function/__init__.py +4 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +19 -102
- mindspore/ops/function/debug_func.py +8 -5
- mindspore/ops/function/grad/grad_func.py +5 -13
- mindspore/ops/function/math_func.py +77 -572
- mindspore/ops/function/nn_func.py +46 -94
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +44 -5
- mindspore/ops/function/vmap_func.py +2 -1
- mindspore/ops/functional.py +4 -4
- mindspore/ops/functional_overload.py +594 -18
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +16 -11
- mindspore/ops/operations/_custom_ops_utils.py +689 -34
- mindspore/ops/operations/_inner_ops.py +14 -18
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +5 -51
- mindspore/ops/operations/comm_ops.py +186 -41
- mindspore/ops/operations/custom_ops.py +303 -177
- mindspore/ops/operations/debug_ops.py +59 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +27 -28
- mindspore/ops/operations/math_ops.py +8 -9
- mindspore/ops/operations/nn_ops.py +8 -40
- mindspore/ops/primitive.py +9 -20
- mindspore/ops/tensor_method.py +63 -15
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
- mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
- mindspore/ops_generate/api/functions_cc_generator.py +58 -10
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
- mindspore/ops_generate/common/base_generator.py +14 -0
- mindspore/ops_generate/common/gen_constants.py +8 -3
- mindspore/ops_generate/common/gen_utils.py +0 -19
- mindspore/ops_generate/common/op_proto.py +11 -4
- mindspore/ops_generate/common/template.py +88 -11
- mindspore/ops_generate/gen_ops.py +1 -1
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
- mindspore/ops_generate/op_def/ops_def_cc_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -16
- mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
- mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
- mindspore/parallel/_auto_parallel_context.py +16 -23
- mindspore/parallel/_cell_wrapper.py +113 -45
- mindspore/parallel/_parallel_serialization.py +4 -3
- mindspore/parallel/_ps_context.py +4 -6
- mindspore/parallel/_tensor.py +167 -12
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/transformer.py +17 -12
- mindspore/parallel/_utils.py +5 -11
- mindspore/parallel/auto_parallel.py +35 -14
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +13 -7
- mindspore/parallel/cluster/process_entity/_api.py +88 -49
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +48 -7
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +12 -12
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +50 -14
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -14
- mindspore/parallel/shard.py +10 -25
- mindspore/parallel/transform_safetensors.py +469 -174
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +12 -6
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
- mindspore/profiler/analysis/task_manager.py +1 -1
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +10 -9
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +43 -23
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
- mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
- mindspore/profiler/common/constant.py +16 -0
- mindspore/profiler/common/msprof_cmd_tool.py +2 -2
- mindspore/profiler/common/path_manager.py +9 -0
- mindspore/profiler/common/profiler_context.py +50 -29
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_meta_data.py +1 -0
- mindspore/profiler/common/profiler_op_analyse.py +239 -0
- mindspore/profiler/common/profiler_output_path.py +23 -8
- mindspore/profiler/common/profiler_parameters.py +128 -35
- mindspore/profiler/dynamic_profile/__init__.py +0 -0
- mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
- mindspore/profiler/dynamic_profiler.py +374 -338
- mindspore/profiler/envprofiler.py +42 -12
- mindspore/profiler/experimental_config.py +112 -7
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/cpu_profiler.py +10 -4
- mindspore/profiler/platform/npu_profiler.py +30 -20
- mindspore/profiler/profiler.py +218 -154
- mindspore/profiler/profiler_action_controller.py +65 -77
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/profiler/schedule.py +10 -4
- mindspore/rewrite/common/config.py +1 -0
- mindspore/rewrite/common/namer.py +1 -0
- mindspore/rewrite/common/namespace.py +1 -0
- mindspore/rewrite/node/node.py +31 -11
- mindspore/rewrite/parsers/assign_parser.py +1 -1
- mindspore/rewrite/symbol_tree/symbol_tree.py +2 -2
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +8 -6
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +87 -45
- mindspore/runtime/memory.py +31 -32
- mindspore/runtime/thread_bind_core.py +299 -165
- mindspore/safeguard/rewrite_obfuscation.py +12 -13
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +17 -7
- mindspore/train/amp.py +43 -23
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_callback.py +2 -1
- mindspore/train/callback/_checkpoint.py +4 -14
- mindspore/train/callback/_flops_collector.py +11 -7
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +98 -21
- mindspore/train/data_sink.py +15 -6
- mindspore/train/dataset_helper.py +14 -5
- mindspore/train/model.py +133 -69
- mindspore/train/serialization.py +168 -126
- mindspore/train/summary/summary_record.py +13 -2
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +3 -2
- mindspore/utils/dryrun.py +0 -6
- mindspore/utils/runtime_execution_order_check.py +163 -77
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +14 -17
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/RECORD +403 -442
- mindspore/_deprecated/jit.py +0 -198
- mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
- mindspore/communication/_hccl_management.py +0 -297
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- mindspore/profiler/common/validator/__init__.py +0 -14
- mindspore/profiler/common/validator/validate_path.py +0 -84
- mindspore/profiler/parser/__init__.py +0 -14
- mindspore/profiler/parser/aicpu_data_parser.py +0 -272
- mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
- mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
- mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
- mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
- mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
- mindspore/profiler/parser/ascend_flops_generator.py +0 -116
- mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
- mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
- mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
- mindspore/profiler/parser/ascend_op_generator.py +0 -334
- mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
- mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
- mindspore/profiler/parser/base_timeline_generator.py +0 -483
- mindspore/profiler/parser/container.py +0 -229
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
- mindspore/profiler/parser/flops_parser.py +0 -531
- mindspore/profiler/parser/framework_enum.py +0 -111
- mindspore/profiler/parser/framework_parser.py +0 -464
- mindspore/profiler/parser/framework_struct.py +0 -61
- mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
- mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
- mindspore/profiler/parser/hccl_parser.py +0 -573
- mindspore/profiler/parser/hwts_log_parser.py +0 -122
- mindspore/profiler/parser/integrator.py +0 -526
- mindspore/profiler/parser/memory_usage_parser.py +0 -277
- mindspore/profiler/parser/minddata_analyzer.py +0 -800
- mindspore/profiler/parser/minddata_parser.py +0 -186
- mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
- mindspore/profiler/parser/op_intermediate_parser.py +0 -149
- mindspore/profiler/parser/optime_parser.py +0 -250
- mindspore/profiler/parser/profiler_info.py +0 -213
- mindspore/profiler/parser/step_trace_parser.py +0 -666
- mindspore/utils/hooks.py +0 -81
- /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -48,7 +48,8 @@ from .datasets import UnionBaseDataset, MappableDataset, Schema, to_list, _Pytho
|
|
|
48
48
|
from .queue import _SharedQueue
|
|
49
49
|
from .validators import check_generator_dataset, check_numpy_slices_dataset, check_padded_dataset
|
|
50
50
|
from ..core.config import get_enable_shared_mem, get_prefetch_size, get_multiprocessing_timeout_interval, \
|
|
51
|
-
get_enable_watchdog, get_debug_mode, get_seed, set_seed, get_multiprocessing_start_method
|
|
51
|
+
get_enable_watchdog, get_debug_mode, get_seed, set_seed, get_multiprocessing_start_method, get_video_backend, \
|
|
52
|
+
set_video_backend
|
|
52
53
|
from ..core.datatypes import mstypelist_to_detypelist
|
|
53
54
|
from ..core.py_util_helpers import ExceptionHandler
|
|
54
55
|
from ..core.validator_helpers import type_check
|
|
@@ -220,6 +221,7 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
220
221
|
|
|
221
222
|
self.ppid = os.getpid()
|
|
222
223
|
self.pids = []
|
|
224
|
+
self.thread_ids = []
|
|
223
225
|
self.check_interval = get_multiprocessing_timeout_interval() # the interval of check queue's size
|
|
224
226
|
|
|
225
227
|
if self.multi_process is True:
|
|
@@ -277,12 +279,32 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
277
279
|
worker = _GeneratorWorkerMt(self.dataset, self.eof, worker_id)
|
|
278
280
|
worker.daemon = True
|
|
279
281
|
self.need_join = True
|
|
282
|
+
worker.start()
|
|
283
|
+
self.thread_ids.append(worker.ident)
|
|
280
284
|
self.workers.append(worker)
|
|
281
285
|
|
|
282
286
|
# Register a termination function using weakref to avoid the object from unable to properly destruct.
|
|
283
287
|
atexit.register(lambda cleanup: cleanup()() if cleanup() is not None else None,
|
|
284
288
|
weakref.WeakMethod(self.terminate))
|
|
285
289
|
|
|
290
|
+
def get_worker_ids(self):
|
|
291
|
+
"""
|
|
292
|
+
Get dict of worker's ids
|
|
293
|
+
|
|
294
|
+
Returns:
|
|
295
|
+
dict of strings
|
|
296
|
+
"""
|
|
297
|
+
if not self.is_mp_enabled():
|
|
298
|
+
return {}
|
|
299
|
+
worker_ids = {}
|
|
300
|
+
if self.multi_process is True:
|
|
301
|
+
worker_ids["is_thread"] = False
|
|
302
|
+
worker_ids["worker_id"] = self.pids
|
|
303
|
+
else:
|
|
304
|
+
worker_ids["is_thread"] = True
|
|
305
|
+
worker_ids["worker_id"] = self.thread_ids
|
|
306
|
+
return worker_ids
|
|
307
|
+
|
|
286
308
|
def terminate(self):
|
|
287
309
|
self._stop_subprocess()
|
|
288
310
|
|
|
@@ -345,12 +367,12 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
345
367
|
start_time = int(time.time())
|
|
346
368
|
wait_count = 1
|
|
347
369
|
while self.workers[i % self.num_worker].res_queue.empty():
|
|
370
|
+
time.sleep(0.1)
|
|
348
371
|
if self.eof.is_set():
|
|
349
372
|
logger.warning("Generator receives a termination signal, stop waiting for data "
|
|
350
373
|
"from subprocess.")
|
|
351
374
|
self._stop_subprocess()
|
|
352
375
|
return
|
|
353
|
-
time.sleep(0.1)
|
|
354
376
|
wait_count = self._interval_log(i, start_time, wait_count)
|
|
355
377
|
result = self.workers[i % self.num_worker].get()
|
|
356
378
|
if isinstance(result, ExceptionHandler):
|
|
@@ -421,9 +443,10 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
421
443
|
"process(es): {}".format(self.cleaning_process.pid, [worker.pid for worker in self.workers]))
|
|
422
444
|
|
|
423
445
|
if get_enable_watchdog():
|
|
424
|
-
worker_ids = [
|
|
446
|
+
worker_ids = [os.getpid()]
|
|
447
|
+
worker_ids.extend([worker.pid for worker in self.workers])
|
|
425
448
|
worker_ids.append(self.cleaning_process.pid)
|
|
426
|
-
cde.register_worker_pids(id(self),
|
|
449
|
+
cde.register_worker_pids(id(self), worker_ids)
|
|
427
450
|
|
|
428
451
|
def _release_fd(self):
|
|
429
452
|
"""Release the file descriptor by subprocess"""
|
|
@@ -480,6 +503,8 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
480
503
|
except Exception: # pylint: disable=W0703
|
|
481
504
|
# Block all errors when join
|
|
482
505
|
continue
|
|
506
|
+
elif not self.multi_process:
|
|
507
|
+
w.join(timeout=5)
|
|
483
508
|
|
|
484
509
|
if self.multi_process is True:
|
|
485
510
|
self._release_fd()
|
|
@@ -497,6 +522,10 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
497
522
|
cde.deregister_worker_pids(id(self))
|
|
498
523
|
if hasattr(self, 'eof') and self.eof is not None:
|
|
499
524
|
self.eof.set()
|
|
525
|
+
# send QUIT flag to workers, and the worker's while loop could check the eof flag
|
|
526
|
+
for worker in self.workers:
|
|
527
|
+
if not worker.queue_full():
|
|
528
|
+
worker.put("QUIT")
|
|
500
529
|
if hasattr(self, 'cleaning_process') and self.cleaning_process is not None:
|
|
501
530
|
# let the quit event notify the cleaning process to exit
|
|
502
531
|
self.cleaning_process.join(timeout=5)
|
|
@@ -538,7 +567,8 @@ def _main_process_already_exit(eof, is_multiprocessing, idx_queue, result_queue,
|
|
|
538
567
|
return False
|
|
539
568
|
|
|
540
569
|
|
|
541
|
-
def _generator_worker_loop(dataset, idx_queue, result_queue, eof, is_multiprocessing, worker_id, ppid=-1
|
|
570
|
+
def _generator_worker_loop(dataset, idx_queue, result_queue, eof, is_multiprocessing, worker_id, ppid=-1,
|
|
571
|
+
video_backend=None):
|
|
542
572
|
"""
|
|
543
573
|
Multithread or multiprocess generator worker process loop.
|
|
544
574
|
"""
|
|
@@ -546,6 +576,9 @@ def _generator_worker_loop(dataset, idx_queue, result_queue, eof, is_multiproces
|
|
|
546
576
|
cde.register_worker_handlers()
|
|
547
577
|
|
|
548
578
|
if is_multiprocessing:
|
|
579
|
+
if video_backend is not None:
|
|
580
|
+
set_video_backend(video_backend)
|
|
581
|
+
|
|
549
582
|
result_queue.cancel_join_thread() # Ensure that the process does not hang when exiting
|
|
550
583
|
|
|
551
584
|
# init the random seed and np.random seed for the subprocess
|
|
@@ -634,6 +667,9 @@ class _GeneratorWorkerMt(threading.Thread):
|
|
|
634
667
|
return False
|
|
635
668
|
return True
|
|
636
669
|
|
|
670
|
+
def queue_full(self):
|
|
671
|
+
return self.idx_queue.full()
|
|
672
|
+
|
|
637
673
|
|
|
638
674
|
class _GeneratorWorkerMp(multiprocessing.Process):
|
|
639
675
|
"""
|
|
@@ -647,8 +683,9 @@ class _GeneratorWorkerMp(multiprocessing.Process):
|
|
|
647
683
|
else:
|
|
648
684
|
self.res_queue = multiprocessing.Queue(queue_size)
|
|
649
685
|
self.idx_queue.cancel_join_thread() # Ensure that the process does not hang when exiting
|
|
686
|
+
video_backend = get_video_backend() if multiprocessing.get_start_method() == "spawn" else None
|
|
650
687
|
super().__init__(target=_generator_worker_loop,
|
|
651
|
-
args=(dataset, self.idx_queue, self.res_queue, eof, True, worker_id, ppid),
|
|
688
|
+
args=(dataset, self.idx_queue, self.res_queue, eof, True, worker_id, ppid, video_backend),
|
|
652
689
|
name="GeneratorWorkerProcess" + str(worker_id))
|
|
653
690
|
|
|
654
691
|
def put(self, item):
|
|
@@ -674,6 +711,9 @@ class _GeneratorWorkerMp(multiprocessing.Process):
|
|
|
674
711
|
return False
|
|
675
712
|
return True
|
|
676
713
|
|
|
714
|
+
def queue_full(self):
|
|
715
|
+
return self.idx_queue.full()
|
|
716
|
+
|
|
677
717
|
def __del__(self):
|
|
678
718
|
# del all the Queue & SharedQueue when the iter had been deleted from ITERATORS_LIST
|
|
679
719
|
if hasattr(self, 'idx_queue'):
|
|
@@ -776,24 +816,11 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
776
816
|
collate_fn (Callable[List[numpy.ndarray]], optional): Define how to merge a list of data into a batch.
|
|
777
817
|
Only valid if `batch_sampler` is used. Default: ``None`` , do not use collation function.
|
|
778
818
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
ValueError: If sampler and sharding are specified at the same time.
|
|
785
|
-
ValueError: If `num_shards` is specified but shard_id is None.
|
|
786
|
-
ValueError: If shard_id is specified but `num_shards` is None.
|
|
787
|
-
ValueError: If `shard_id` is not in range of [0, `num_shards` ).
|
|
788
|
-
TypeError: If `batch_sampler` is not iterable.
|
|
789
|
-
ValueError: If `batch_sampler` is specified together with `num_samples` ,
|
|
790
|
-
`shuffle` , `num_shards` , `shard_id` and `sampler`.
|
|
791
|
-
TypeError: If `collate_fn` is not callable.
|
|
792
|
-
ValueError: If `collate_fn` is specified while `batch_sampler` is None.
|
|
793
|
-
|
|
794
|
-
Tutorial Examples:
|
|
795
|
-
- `Load & Process Data With Dataset Pipeline
|
|
796
|
-
<https://www.mindspore.cn/docs/en/master/api_python/samples/dataset/dataset_gallery.html>`_
|
|
819
|
+
.. warning::
|
|
820
|
+
`GeneratorDataset` uses `dill` module implicitly in multiprocessing `spawn` mode to serialize/deserialize
|
|
821
|
+
`source`, which is known to be insecure. It is possible to construct malicious pickle data which will
|
|
822
|
+
execute arbitrary code during unpickling. Never load data that could have come from untrusted sources,
|
|
823
|
+
or has been tampered with.
|
|
797
824
|
|
|
798
825
|
Note:
|
|
799
826
|
- If you configure `python_multiprocessing=True` (Default: ``True`` ) and `num_parallel_workers>1`
|
|
@@ -843,6 +870,21 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
843
870
|
|
|
844
871
|
.. include:: mindspore.dataset.sampler.txt
|
|
845
872
|
|
|
873
|
+
Raises:
|
|
874
|
+
RuntimeError: If source raises an exception during execution.
|
|
875
|
+
RuntimeError: If len of column_names does not match output len of source.
|
|
876
|
+
ValueError: If `num_parallel_workers` exceeds the max thread numbers.
|
|
877
|
+
ValueError: If sampler and shuffle are specified at the same time.
|
|
878
|
+
ValueError: If sampler and sharding are specified at the same time.
|
|
879
|
+
ValueError: If `num_shards` is specified but shard_id is None.
|
|
880
|
+
ValueError: If shard_id is specified but `num_shards` is None.
|
|
881
|
+
ValueError: If `shard_id` is not in range of [0, `num_shards` ).
|
|
882
|
+
ValueError: If `batch_sampler` is specified together with `num_samples` ,
|
|
883
|
+
`shuffle` , `num_shards` , `shard_id` and `sampler`.
|
|
884
|
+
ValueError: If `collate_fn` is specified while `batch_sampler` is None.
|
|
885
|
+
TypeError: If `batch_sampler` is not iterable.
|
|
886
|
+
TypeError: If `collate_fn` is not callable.
|
|
887
|
+
|
|
846
888
|
Examples:
|
|
847
889
|
>>> import mindspore.dataset as ds
|
|
848
890
|
>>> import numpy as np
|
|
@@ -901,6 +943,10 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
901
943
|
>>>
|
|
902
944
|
>>> # list, dict, tuple of Python is also random accessible
|
|
903
945
|
>>> dataset = ds.GeneratorDataset(source=[(np.array(0),), (np.array(1),), (np.array(2),)], column_names=["col"])
|
|
946
|
+
|
|
947
|
+
Tutorial Examples:
|
|
948
|
+
- `Load & Process Data With Dataset Pipeline
|
|
949
|
+
<https://www.mindspore.cn/docs/en/master/api_python/samples/dataset/dataset_gallery.html>`_
|
|
904
950
|
"""
|
|
905
951
|
|
|
906
952
|
@check_generator_dataset
|
|
@@ -220,7 +220,7 @@ class Iterator:
|
|
|
220
220
|
dataset: Dataset to be iterated over
|
|
221
221
|
"""
|
|
222
222
|
|
|
223
|
-
def __init__(self, dataset, num_epochs=-1, output_numpy=False, do_copy=
|
|
223
|
+
def __init__(self, dataset, num_epochs=-1, output_numpy=False, do_copy=False):
|
|
224
224
|
self._col_names = None
|
|
225
225
|
|
|
226
226
|
# create a copy of tree and work on it.
|
|
@@ -493,7 +493,7 @@ class TupleIterator(Iterator):
|
|
|
493
493
|
The derived class of Iterator with list type.
|
|
494
494
|
"""
|
|
495
495
|
|
|
496
|
-
def __init__(self, dataset, columns=None, num_epochs=-1, output_numpy=False, do_copy=
|
|
496
|
+
def __init__(self, dataset, columns=None, num_epochs=-1, output_numpy=False, do_copy=False):
|
|
497
497
|
if columns is not None:
|
|
498
498
|
if not isinstance(columns, list):
|
|
499
499
|
columns = [columns]
|
|
@@ -57,12 +57,12 @@ class _Config:
|
|
|
57
57
|
|
|
58
58
|
def _convert_type(self, key):
|
|
59
59
|
if key not in self.config:
|
|
60
|
-
return
|
|
60
|
+
return os.environ[key]
|
|
61
61
|
if isinstance(self.config[key], int):
|
|
62
62
|
return int(os.environ[key])
|
|
63
63
|
if isinstance(self.config[key], float):
|
|
64
64
|
return float(os.environ[key])
|
|
65
|
-
return
|
|
65
|
+
return os.environ[key]
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
config = _Config()
|
|
@@ -506,3 +506,11 @@ class MindRecordFromOBS:
|
|
|
506
506
|
path = os.path.join(self._local_path, target_dataset)
|
|
507
507
|
_iteration = MindDataset(dataset_files=[path], shuffle=False)
|
|
508
508
|
return _iteration.get_col_names()
|
|
509
|
+
|
|
510
|
+
def close(self):
|
|
511
|
+
if self._pool:
|
|
512
|
+
self._pool.terminate()
|
|
513
|
+
self._pool = None
|
|
514
|
+
|
|
515
|
+
def __del__(self):
|
|
516
|
+
self.close()
|
|
@@ -286,7 +286,7 @@ class Mask(TensorOperation):
|
|
|
286
286
|
operator (Relational): relational operators, it can be any of [Relational.EQ, Relational.NE, Relational.LT,
|
|
287
287
|
Relational.GT, Relational.LE, Relational.GE], take Relational.EQ as example, EQ refers to equal.
|
|
288
288
|
constant (Union[str, int, float, bool]): Constant to be compared to.
|
|
289
|
-
dtype (mindspore.dtype, optional): Type of the generated mask. Default: mstype.
|
|
289
|
+
dtype (mindspore.dtype, optional): Type of the generated mask. Default: mstype.bool.
|
|
290
290
|
|
|
291
291
|
Raises:
|
|
292
292
|
TypeError: `operator` is not of type Relational.
|
|
@@ -315,7 +315,7 @@ class Mask(TensorOperation):
|
|
|
315
315
|
|
|
316
316
|
@deprecated_c_transforms()
|
|
317
317
|
@check_mask_op
|
|
318
|
-
def __init__(self, operator, constant, dtype=mstype.
|
|
318
|
+
def __init__(self, operator, constant, dtype=mstype.bool):
|
|
319
319
|
self.operator = operator
|
|
320
320
|
self.dtype = mstype_to_detype(dtype)
|
|
321
321
|
self.constant = cde.Tensor(np.array(constant))
|
|
@@ -51,10 +51,14 @@ class PyTensorOperation:
|
|
|
51
51
|
if "transforms" in json_obj.keys():
|
|
52
52
|
# operations which have transforms as input, need to call _from_json() for each transform to deseriallize
|
|
53
53
|
transforms = []
|
|
54
|
+
valid_module = ['mindspore.dataset.vision', 'mindspore.dataset.text',
|
|
55
|
+
'mindspore.dataset.audio', 'mindspore.dataset.transforms']
|
|
54
56
|
for json_op in json_obj["transforms"]:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
py_module = sys.modules.get(json_op.get("python_module"))
|
|
58
|
+
if py_module.__package__ not in valid_module:
|
|
59
|
+
raise RuntimeError('Invalid json content, try to serialzie dataset again.')
|
|
60
|
+
transforms.append(getattr(py_module, json_op.get("tensor_op_name")).from_json(
|
|
61
|
+
json.dumps(json_op.get("tensor_op_params"))))
|
|
58
62
|
new_op.transforms = transforms
|
|
59
63
|
if "output_type" in json_obj.keys():
|
|
60
64
|
output_type = np.dtype(json_obj["output_type"])
|
|
@@ -165,10 +165,14 @@ class PyTensorOperation:
|
|
|
165
165
|
if "transforms" in json_obj.keys():
|
|
166
166
|
# operations which have transforms as input, need to call _from_json() for each transform to deseriallize
|
|
167
167
|
transforms = []
|
|
168
|
+
valid_module = ['mindspore.dataset.vision', 'mindspore.dataset.text',
|
|
169
|
+
'mindspore.dataset.audio', 'mindspore.dataset.transforms']
|
|
168
170
|
for json_op in json_obj["transforms"]:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
py_module = sys.modules.get(json_op.get("python_module"))
|
|
172
|
+
if py_module.__package__ not in valid_module:
|
|
173
|
+
raise RuntimeError('Invalid json content, try to serialzie dataset again.')
|
|
174
|
+
transforms.append(getattr(py_module, json_op["tensor_op_name"]).from_json(
|
|
175
|
+
json.dumps(json_op["tensor_op_params"])))
|
|
172
176
|
new_op.transforms = transforms
|
|
173
177
|
if "output_type" in json_obj.keys():
|
|
174
178
|
output_type = np.dtype(json_obj["output_type"])
|
|
@@ -609,7 +613,7 @@ class Mask(TensorOperation):
|
|
|
609
613
|
``Relational.GT``, ``Relational.LE``, ``Relational.GE``, take ``Relational.EQ`` as example,
|
|
610
614
|
EQ refers to equal.
|
|
611
615
|
constant (Union[str, int, float, bool]): Constant to be compared to.
|
|
612
|
-
dtype (mindspore.dtype, optional): Type of the generated mask. Default: ``mstype.
|
|
616
|
+
dtype (mindspore.dtype, optional): Type of the generated mask. Default: ``mstype.bool``.
|
|
613
617
|
|
|
614
618
|
Raises:
|
|
615
619
|
TypeError: `operator` is not of type Relational.
|
|
@@ -650,7 +654,7 @@ class Mask(TensorOperation):
|
|
|
650
654
|
"""
|
|
651
655
|
|
|
652
656
|
@check_mask_op_new
|
|
653
|
-
def __init__(self, operator, constant, dtype=mstype.
|
|
657
|
+
def __init__(self, operator, constant, dtype=mstype.bool):
|
|
654
658
|
super().__init__()
|
|
655
659
|
self.operator = operator
|
|
656
660
|
self.dtype = mstype_to_detype(dtype)
|
|
@@ -1167,7 +1171,7 @@ class TypeCast(TensorOperation):
|
|
|
1167
1171
|
to be cast to.
|
|
1168
1172
|
|
|
1169
1173
|
Raises:
|
|
1170
|
-
TypeError: If `data_type` is not of MindSpore data type bool, int, float, string or type
|
|
1174
|
+
TypeError: If `data_type` is not of MindSpore data type bool, int, float, string or type `numpy.dtype` .
|
|
1171
1175
|
|
|
1172
1176
|
Supported Platforms:
|
|
1173
1177
|
``CPU`` ``GPU`` ``Ascend``
|
|
@@ -54,5 +54,5 @@ from .transforms import AdjustBrightness, AdjustContrast, AdjustGamma, AdjustHue
|
|
|
54
54
|
ResizeWithBBox, RgbToHsv, Rotate, SlicePatches, Solarize, TenCrop, ToNumpy, ToPIL, ToTensor, ToType, \
|
|
55
55
|
TrivialAugmentWide, UniformAugment, VerticalFlip, not_random
|
|
56
56
|
from .utils import AutoAugmentPolicy, Border, ConvertMode, ImageBatchFormat, ImageReadMode, Inter, SliceMode, \
|
|
57
|
-
encode_jpeg, encode_png, get_image_num_channels, get_image_size, read_file, read_image, read_video, \
|
|
57
|
+
VideoDecoder, encode_jpeg, encode_png, get_image_num_channels, get_image_size, read_file, read_image, read_video, \
|
|
58
58
|
read_video_timestamps, write_file, write_jpeg, write_png
|
|
@@ -493,7 +493,7 @@ class HWC2CHW(py_transforms.PyTensorOperation):
|
|
|
493
493
|
If the input image is of shape <H, W>, it will remain unchanged.
|
|
494
494
|
|
|
495
495
|
Raises:
|
|
496
|
-
TypeError: If the input image is not of type
|
|
496
|
+
TypeError: If the input image is not of type `numpy.ndarray` .
|
|
497
497
|
TypeError: If shape of the input image is not <H, W> or <H, W, C>.
|
|
498
498
|
|
|
499
499
|
Supported Platforms:
|
|
@@ -575,8 +575,8 @@ class LinearTransformation(py_transforms.PyTensorOperation):
|
|
|
575
575
|
mean_vector (numpy.ndarray): A mean vector in shape of (D,), where :math:`D = C \times H \times W` .
|
|
576
576
|
|
|
577
577
|
Raises:
|
|
578
|
-
TypeError: If `transformation_matrix` is not of type
|
|
579
|
-
TypeError: If `mean_vector` is not of type
|
|
578
|
+
TypeError: If `transformation_matrix` is not of type `numpy.ndarray` .
|
|
579
|
+
TypeError: If `mean_vector` is not of type `numpy.ndarray` .
|
|
580
580
|
|
|
581
581
|
Supported Platforms:
|
|
582
582
|
``CPU``
|
|
@@ -711,7 +711,7 @@ class Normalize(py_transforms.PyTensorOperation):
|
|
|
711
711
|
and be arranged in channel order.
|
|
712
712
|
|
|
713
713
|
Raises:
|
|
714
|
-
TypeError: If the input image is not of type
|
|
714
|
+
TypeError: If the input image is not of type `numpy.ndarray` .
|
|
715
715
|
TypeError: If dimension of the input image is not 3.
|
|
716
716
|
NotImplementedError: If dtype of the input image is int.
|
|
717
717
|
ValueError: If lengths of `mean` and `std` are not equal.
|
|
@@ -780,7 +780,7 @@ class NormalizePad(py_transforms.PyTensorOperation):
|
|
|
780
780
|
Default: ``"float32"``.
|
|
781
781
|
|
|
782
782
|
Raises:
|
|
783
|
-
TypeError: If the input image is not of type
|
|
783
|
+
TypeError: If the input image is not of type `numpy.ndarray` .
|
|
784
784
|
TypeError: If dimension of the input image is not 3.
|
|
785
785
|
NotImplementedError: If dtype of the input image is int.
|
|
786
786
|
ValueError: If lengths of `mean` and `std` are not equal.
|
|
@@ -1930,7 +1930,7 @@ class ToPIL(py_transforms.PyTensorOperation):
|
|
|
1930
1930
|
The conversion mode will be determined by the data type using `PIL.Image.fromarray` .
|
|
1931
1931
|
|
|
1932
1932
|
Raises:
|
|
1933
|
-
TypeError: If the input image is not of type
|
|
1933
|
+
TypeError: If the input image is not of type `numpy.ndarray` or `PIL.Image.Image` .
|
|
1934
1934
|
|
|
1935
1935
|
Supported Platforms:
|
|
1936
1936
|
``CPU``
|
|
@@ -1974,7 +1974,7 @@ class ToTensor(py_transforms.PyTensorOperation):
|
|
|
1974
1974
|
output_type (numpy.dtype, optional): The desired dtype of the output image. Default: ``numpy.float32`` .
|
|
1975
1975
|
|
|
1976
1976
|
Raises:
|
|
1977
|
-
TypeError: If the input image is not of type `PIL.Image.Image` or
|
|
1977
|
+
TypeError: If the input image is not of type `PIL.Image.Image` or `numpy.ndarray` .
|
|
1978
1978
|
TypeError: If dimension of the input image is not 2 or 3.
|
|
1979
1979
|
|
|
1980
1980
|
Supported Platforms:
|
|
@@ -2018,7 +2018,7 @@ class ToType(py_transforms.PyTensorOperation):
|
|
|
2018
2018
|
output_type (numpy.dtype): The desired dtype of the output image, e.g. ``numpy.float32`` .
|
|
2019
2019
|
|
|
2020
2020
|
Raises:
|
|
2021
|
-
TypeError: If the input image is not of type
|
|
2021
|
+
TypeError: If the input image is not of type `numpy.ndarray` .
|
|
2022
2022
|
|
|
2023
2023
|
Supported Platforms:
|
|
2024
2024
|
``CPU``
|
|
@@ -2759,8 +2759,8 @@ class LinearTransformation(PyTensorOperation):
|
|
|
2759
2759
|
mean_vector (numpy.ndarray): A mean vector in shape of (D,), where :math:`D = C \times H \times W` .
|
|
2760
2760
|
|
|
2761
2761
|
Raises:
|
|
2762
|
-
TypeError: If `transformation_matrix` is not of type
|
|
2763
|
-
TypeError: If `mean_vector` is not of type
|
|
2762
|
+
TypeError: If `transformation_matrix` is not of type `numpy.ndarray` .
|
|
2763
|
+
TypeError: If `mean_vector` is not of type `numpy.ndarray` .
|
|
2764
2764
|
|
|
2765
2765
|
Supported Platforms:
|
|
2766
2766
|
``CPU``
|
|
@@ -6911,7 +6911,7 @@ class ToPIL(PyTensorOperation):
|
|
|
6911
6911
|
Convert the input decoded numpy.ndarray image to PIL Image.
|
|
6912
6912
|
|
|
6913
6913
|
Raises:
|
|
6914
|
-
TypeError: If the input image is not of type
|
|
6914
|
+
TypeError: If the input image is not of type `numpy.ndarray` or `PIL.Image.Image` .
|
|
6915
6915
|
|
|
6916
6916
|
Supported Platforms:
|
|
6917
6917
|
``CPU``
|
|
@@ -6975,7 +6975,7 @@ class ToTensor(ImageTensorOperation):
|
|
|
6975
6975
|
Default: ``np.float32`` .
|
|
6976
6976
|
|
|
6977
6977
|
Raises:
|
|
6978
|
-
TypeError: If the input image is not of type `PIL.Image.Image` or
|
|
6978
|
+
TypeError: If the input image is not of type `PIL.Image.Image` or `numpy.ndarray` .
|
|
6979
6979
|
TypeError: If dimension of the input image is not 2 or 3.
|
|
6980
6980
|
|
|
6981
6981
|
Supported Platforms:
|
|
@@ -7025,6 +7025,18 @@ class ToTensor(ImageTensorOperation):
|
|
|
7025
7025
|
def parse(self):
|
|
7026
7026
|
return cde.ToTensorOperation(self.output_type)
|
|
7027
7027
|
|
|
7028
|
+
def _execute_py(self, img):
|
|
7029
|
+
"""
|
|
7030
|
+
Execute method.
|
|
7031
|
+
|
|
7032
|
+
Args:
|
|
7033
|
+
img (PIL Image): Convert PIL Image to np.ndarray by method HWC to CHW and divide 255.
|
|
7034
|
+
|
|
7035
|
+
Returns:
|
|
7036
|
+
Image converted to numpy.ndarray.
|
|
7037
|
+
"""
|
|
7038
|
+
return util.to_tensor(img, self.output_type)
|
|
7039
|
+
|
|
7028
7040
|
|
|
7029
7041
|
class ToType(TypeCast):
|
|
7030
7042
|
"""
|
|
@@ -7041,7 +7053,7 @@ class ToType(TypeCast):
|
|
|
7041
7053
|
such as ``numpy.float32`` .
|
|
7042
7054
|
|
|
7043
7055
|
Raises:
|
|
7044
|
-
TypeError: If `data_type` is not of type :class:`mindspore.dtype` or
|
|
7056
|
+
TypeError: If `data_type` is not of type :class:`mindspore.dtype` or `numpy.dtype` .
|
|
7045
7057
|
|
|
7046
7058
|
Supported Platforms:
|
|
7047
7059
|
``CPU`` ``GPU`` ``Ascend``
|