mindspore 2.7.0rc1__cp310-cp310-win_amd64.whl → 2.7.1__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/__init__.py +5 -2
- mindspore/_c_dataengine.cp310-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +2 -2
- mindspore/_extends/builtin_operations.py +3 -3
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/compile_config.py +24 -1
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +6 -3
- mindspore/_extends/parse/parser.py +28 -22
- mindspore/_extends/parse/resources.py +1 -1
- mindspore/_extends/parse/standard_method.py +23 -2
- mindspore/_extends/parse/trope.py +2 -1
- mindspore/_extends/pijit/pijit_func_white_list.py +9 -27
- mindspore/amp.py +0 -18
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/base.py +29 -2
- mindspore/common/__init__.py +18 -12
- mindspore/common/_decorator.py +3 -2
- mindspore/common/_grad_function.py +3 -1
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +371 -96
- mindspore/common/_utils.py +7 -43
- mindspore/common/api.py +434 -135
- mindspore/common/dtype.py +98 -57
- mindspore/common/dump.py +7 -108
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +15 -23
- mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
- mindspore/common/file_system.py +59 -9
- mindspore/common/hook_handle.py +82 -3
- mindspore/common/jit_config.py +5 -1
- mindspore/common/jit_trace.py +27 -12
- mindspore/common/lazy_inline.py +5 -3
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +17 -127
- mindspore/common/recompute.py +4 -13
- mindspore/common/tensor.py +50 -217
- mindspore/communication/_comm_helper.py +11 -1
- mindspore/communication/comm_func.py +138 -4
- mindspore/communication/management.py +85 -1
- mindspore/config/op_info.config +0 -15
- mindspore/context.py +20 -106
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +35 -1
- mindspore/dataset/engine/datasets.py +338 -319
- mindspore/dataset/engine/datasets_user_defined.py +38 -22
- mindspore/dataset/engine/datasets_vision.py +1 -1
- mindspore/dataset/engine/validators.py +1 -15
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/transforms.py +3 -3
- mindspore/dataset/vision/__init__.py +1 -1
- mindspore/dataset/vision/py_transforms.py +8 -8
- mindspore/dataset/vision/transforms.py +17 -5
- mindspore/dataset/vision/utils.py +632 -21
- mindspore/device_context/ascend/op_tuning.py +35 -1
- mindspore/dnnl.dll +0 -0
- mindspore/{profiler/common/validator → graph}/__init__.py +9 -1
- mindspore/graph/custom_pass.py +55 -0
- mindspore/include/api/cell.h +28 -4
- mindspore/include/api/cfg.h +24 -7
- mindspore/include/api/context.h +1 -0
- mindspore/include/api/delegate.h +0 -2
- mindspore/include/api/dual_abi_helper.h +100 -19
- mindspore/include/api/graph.h +14 -1
- mindspore/include/api/kernel.h +16 -3
- mindspore/include/api/kernel_api.h +9 -1
- mindspore/include/api/metrics/accuracy.h +9 -0
- mindspore/include/api/model.h +5 -1
- mindspore/include/api/model_group.h +4 -0
- mindspore/include/api/model_parallel_runner.h +2 -0
- mindspore/include/api/status.h +48 -10
- mindspore/include/api/types.h +6 -1
- mindspore/include/dataset/constants.h +9 -0
- mindspore/include/dataset/execute.h +2 -2
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/__init__.py +3 -3
- mindspore/mindrecord/common/exceptions.py +1 -0
- mindspore/mindrecord/config.py +1 -1
- mindspore/{parallel/mpi → mindrecord/core}/__init__.py +4 -1
- mindspore/mindrecord/{shardheader.py → core/shardheader.py} +2 -1
- mindspore/mindrecord/{shardindexgenerator.py → core/shardindexgenerator.py} +1 -1
- mindspore/mindrecord/{shardreader.py → core/shardreader.py} +2 -1
- mindspore/mindrecord/{shardsegment.py → core/shardsegment.py} +2 -2
- mindspore/mindrecord/{shardutils.py → core/shardutils.py} +1 -1
- mindspore/mindrecord/{shardwriter.py → core/shardwriter.py} +1 -1
- mindspore/mindrecord/filereader.py +4 -4
- mindspore/mindrecord/filewriter.py +5 -5
- mindspore/mindrecord/mindpage.py +2 -2
- mindspore/mindrecord/tools/cifar10.py +4 -3
- mindspore/mindrecord/tools/cifar100.py +1 -1
- mindspore/mindrecord/tools/cifar100_to_mr.py +1 -1
- mindspore/mindrecord/tools/cifar10_to_mr.py +6 -6
- mindspore/mindrecord/tools/csv_to_mr.py +1 -1
- mindspore/mindrecord/tools/imagenet_to_mr.py +1 -1
- mindspore/mindrecord/tools/mnist_to_mr.py +1 -1
- mindspore/mindrecord/tools/tfrecord_to_mr.py +1 -1
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_cluster.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_hardware_abstract.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/{mindspore_ops_host.dll → mindspore_ops_cpu.dll} +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mindspore_runtime_utils.dll +0 -0
- mindspore/mindspore_tools.dll +0 -0
- mindspore/mint/__init__.py +15 -10
- mindspore/mint/distributed/__init__.py +4 -0
- mindspore/mint/distributed/distributed.py +392 -69
- mindspore/mint/nn/__init__.py +2 -16
- mindspore/mint/nn/functional.py +4 -110
- mindspore/mint/nn/layer/__init__.py +0 -2
- mindspore/mint/nn/layer/_functions.py +1 -2
- mindspore/mint/nn/layer/activation.py +0 -6
- mindspore/mint/nn/layer/basic.py +0 -47
- mindspore/mint/nn/layer/conv.py +10 -10
- mindspore/mint/nn/layer/normalization.py +11 -16
- mindspore/mint/nn/layer/pooling.py +0 -4
- mindspore/nn/__init__.py +1 -3
- mindspore/nn/cell.py +231 -239
- mindspore/nn/layer/activation.py +4 -2
- mindspore/nn/layer/basic.py +56 -14
- mindspore/nn/layer/container.py +16 -0
- mindspore/nn/layer/embedding.py +4 -169
- mindspore/nn/layer/image.py +1 -1
- mindspore/nn/layer/normalization.py +2 -1
- mindspore/nn/layer/thor_layer.py +4 -85
- mindspore/nn/optim/ada_grad.py +0 -1
- mindspore/nn/optim/adafactor.py +0 -1
- mindspore/nn/optim/adam.py +32 -127
- mindspore/nn/optim/adamax.py +0 -1
- mindspore/nn/optim/asgd.py +0 -1
- mindspore/nn/optim/ftrl.py +8 -102
- mindspore/nn/optim/lamb.py +1 -4
- mindspore/nn/optim/lars.py +0 -3
- mindspore/nn/optim/lazyadam.py +25 -218
- mindspore/nn/optim/momentum.py +5 -43
- mindspore/nn/optim/optimizer.py +6 -55
- mindspore/nn/optim/proximal_ada_grad.py +0 -1
- mindspore/nn/optim/rmsprop.py +0 -1
- mindspore/nn/optim/rprop.py +0 -1
- mindspore/nn/optim/sgd.py +0 -1
- mindspore/nn/optim/tft_wrapper.py +2 -4
- mindspore/nn/optim/thor.py +0 -2
- mindspore/nn/probability/bijector/bijector.py +7 -8
- mindspore/nn/probability/bijector/gumbel_cdf.py +2 -2
- mindspore/nn/probability/bijector/power_transform.py +20 -21
- mindspore/nn/probability/bijector/scalar_affine.py +5 -5
- mindspore/nn/probability/bijector/softplus.py +13 -14
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/wrap/cell_wrapper.py +39 -5
- mindspore/nn/wrap/grad_reducer.py +4 -89
- mindspore/numpy/array_creations.py +4 -4
- mindspore/numpy/fft.py +9 -9
- mindspore/numpy/utils_const.py +1 -1
- mindspore/{nn/reinforcement → onnx}/__init__.py +5 -8
- mindspore/onnx/onnx_export.py +137 -0
- mindspore/opencv_core4110.dll +0 -0
- mindspore/opencv_imgcodecs4110.dll +0 -0
- mindspore/{opencv_imgproc452.dll → opencv_imgproc4110.dll} +0 -0
- mindspore/ops/__init__.py +2 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +38 -2
- mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
- mindspore/ops/_op_impl/aicpu/__init__.py +0 -10
- mindspore/ops/_op_impl/cpu/__init__.py +1 -5
- mindspore/ops/_op_impl/cpu/{buffer_append.py → joinedstr_op.py} +8 -8
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +28 -24
- mindspore/ops/auto_generate/gen_extend_func.py +6 -11
- mindspore/ops/auto_generate/gen_ops_def.py +385 -154
- mindspore/ops/auto_generate/gen_ops_prim.py +5676 -5167
- mindspore/ops/communication.py +97 -0
- mindspore/ops/composite/__init__.py +5 -2
- mindspore/ops/composite/base.py +16 -2
- mindspore/ops/composite/multitype_ops/__init__.py +3 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +150 -8
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/composite/multitype_ops/add_impl.py +7 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +27 -0
- mindspore/ops/function/__init__.py +2 -0
- mindspore/ops/function/array_func.py +24 -18
- mindspore/ops/function/comm_func.py +3883 -0
- mindspore/ops/function/debug_func.py +7 -6
- mindspore/ops/function/grad/grad_func.py +4 -12
- mindspore/ops/function/math_func.py +89 -86
- mindspore/ops/function/nn_func.py +92 -313
- mindspore/ops/function/random_func.py +9 -18
- mindspore/ops/functional.py +4 -1
- mindspore/ops/functional_overload.py +377 -30
- mindspore/ops/operations/__init__.py +2 -5
- mindspore/ops/operations/_custom_ops_utils.py +7 -9
- mindspore/ops/operations/_inner_ops.py +12 -50
- mindspore/ops/operations/_rl_inner_ops.py +0 -933
- mindspore/ops/operations/array_ops.py +5 -50
- mindspore/ops/operations/comm_ops.py +95 -17
- mindspore/ops/operations/custom_ops.py +237 -22
- mindspore/ops/operations/debug_ops.py +33 -35
- mindspore/ops/operations/manually_defined/ops_def.py +39 -318
- mindspore/ops/operations/math_ops.py +5 -5
- mindspore/ops/operations/nn_ops.py +3 -3
- mindspore/ops/operations/sparse_ops.py +0 -83
- mindspore/ops/primitive.py +4 -27
- mindspore/ops/tensor_method.py +88 -10
- mindspore/ops_generate/aclnn/aclnn_kernel_register_auto_cc_generator.py +5 -5
- mindspore/ops_generate/aclnn/gen_aclnn_implement.py +8 -8
- mindspore/ops_generate/api/functions_cc_generator.py +53 -4
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +25 -11
- mindspore/ops_generate/common/gen_constants.py +11 -10
- mindspore/ops_generate/common/op_proto.py +18 -1
- mindspore/ops_generate/common/template.py +102 -245
- mindspore/ops_generate/common/template_utils.py +212 -0
- mindspore/ops_generate/gen_custom_ops.py +69 -0
- mindspore/ops_generate/op_def/ops_def_cc_generator.py +78 -7
- mindspore/ops_generate/op_def_py/base_op_prim_py_generator.py +360 -0
- mindspore/ops_generate/op_def_py/custom_op_prim_py_generator.py +140 -0
- mindspore/ops_generate/op_def_py/op_def_py_generator.py +54 -7
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -312
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +74 -17
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +22 -5
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +0 -16
- mindspore/ops_generate/pyboost/op_template_parser.py +3 -2
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +21 -5
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +2 -2
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +30 -10
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +10 -3
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +19 -9
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +71 -28
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +10 -9
- mindspore/ops_generate/pyboost/pyboost_utils.py +27 -16
- mindspore/ops_generate/resources/yaml_loader.py +13 -0
- mindspore/ops_generate/tensor_py_cc_generator.py +2 -2
- mindspore/parallel/_auto_parallel_context.py +5 -15
- mindspore/parallel/_cell_wrapper.py +1 -1
- mindspore/parallel/_parallel_serialization.py +4 -6
- mindspore/parallel/_ps_context.py +2 -2
- mindspore/parallel/_utils.py +34 -17
- mindspore/parallel/auto_parallel.py +23 -9
- mindspore/parallel/checkpoint_transform.py +20 -2
- mindspore/parallel/cluster/process_entity/_api.py +28 -33
- mindspore/parallel/cluster/process_entity/_utils.py +9 -5
- mindspore/parallel/cluster/run.py +5 -3
- mindspore/{experimental/llm_boost/ascend_native → parallel/distributed}/__init__.py +21 -22
- mindspore/parallel/distributed/distributed_data_parallel.py +393 -0
- mindspore/parallel/distributed/flatten_grad_buffer.py +295 -0
- mindspore/parallel/function/reshard_func.py +6 -5
- mindspore/parallel/nn/parallel_cell_wrapper.py +40 -3
- mindspore/parallel/nn/parallel_grad_reducer.py +0 -8
- mindspore/parallel/shard.py +7 -21
- mindspore/parallel/strategy.py +336 -0
- mindspore/parallel/transform_safetensors.py +127 -20
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +13 -9
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +1 -1
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +1 -1
- mindspore/profiler/common/constant.py +5 -0
- mindspore/profiler/common/file_manager.py +9 -0
- mindspore/profiler/common/msprof_cmd_tool.py +40 -4
- mindspore/profiler/common/path_manager.py +65 -24
- mindspore/profiler/common/profiler_context.py +27 -14
- mindspore/profiler/common/profiler_info.py +3 -3
- mindspore/profiler/common/profiler_meta_data.py +1 -0
- mindspore/profiler/common/profiler_op_analyse.py +10 -6
- mindspore/profiler/common/profiler_path_manager.py +13 -0
- mindspore/profiler/common/util.py +30 -3
- mindspore/profiler/dynamic_profiler.py +91 -46
- mindspore/profiler/envprofiler.py +30 -5
- mindspore/profiler/experimental_config.py +18 -2
- mindspore/profiler/platform/cpu_profiler.py +10 -4
- mindspore/profiler/platform/npu_profiler.py +34 -7
- mindspore/profiler/profiler.py +193 -145
- mindspore/profiler/profiler_action_controller.py +1 -1
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
- mindspore/run_check/_check_version.py +108 -24
- mindspore/runtime/__init__.py +9 -6
- mindspore/runtime/executor.py +35 -0
- mindspore/runtime/memory.py +113 -0
- mindspore/runtime/thread_bind_core.py +1 -1
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/{experimental/llm_boost → tools}/__init__.py +5 -5
- mindspore/tools/data_dump.py +130 -0
- mindspore/tools/sdc_detect.py +91 -0
- mindspore/tools/stress_detect.py +63 -0
- mindspore/train/__init__.py +6 -6
- mindspore/train/_utils.py +8 -21
- mindspore/train/amp.py +6 -7
- mindspore/train/callback/_callback.py +2 -1
- mindspore/train/callback/_checkpoint.py +1 -17
- mindspore/train/callback/_flops_collector.py +10 -6
- mindspore/train/callback/_train_fault_tolerance.py +72 -25
- mindspore/train/data_sink.py +5 -9
- mindspore/train/dataset_helper.py +5 -5
- mindspore/train/model.py +41 -230
- mindspore/train/serialization.py +160 -401
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +6 -3
- mindspore/utils/dlpack.py +92 -0
- mindspore/utils/dryrun.py +1 -1
- mindspore/utils/runtime_execution_order_check.py +10 -0
- mindspore/utils/sdc_detect.py +14 -12
- mindspore/utils/stress_detect.py +43 -0
- mindspore/utils/utils.py +152 -16
- mindspore/version.py +1 -1
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/METADATA +3 -2
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/RECORD +330 -344
- mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
- mindspore/communication/_hccl_management.py +0 -297
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +0 -207
- mindspore/experimental/llm_boost/ascend_native/llm_boost.py +0 -52
- mindspore/experimental/llm_boost/atb/__init__.py +0 -23
- mindspore/experimental/llm_boost/atb/boost_base.py +0 -385
- mindspore/experimental/llm_boost/atb/llama_boost.py +0 -137
- mindspore/experimental/llm_boost/atb/qwen_boost.py +0 -124
- mindspore/experimental/llm_boost/register.py +0 -130
- mindspore/experimental/llm_boost/utils.py +0 -31
- mindspore/include/OWNERS +0 -7
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/nn/optim/_dist_optimizer_registry.py +0 -111
- mindspore/nn/reinforcement/_batch_read_write.py +0 -142
- mindspore/nn/reinforcement/_tensors_queue.py +0 -152
- mindspore/nn/reinforcement/tensor_array.py +0 -145
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/ops/_op_impl/aicpu/priority_replay_buffer.py +0 -113
- mindspore/ops/_op_impl/aicpu/reservoir_replay_buffer.py +0 -96
- mindspore/ops/_op_impl/aicpu/sparse_cross.py +0 -42
- mindspore/ops/_op_impl/cpu/buffer_get.py +0 -28
- mindspore/ops/_op_impl/cpu/buffer_sample.py +0 -28
- mindspore/ops/_op_impl/cpu/priority_replay_buffer.py +0 -42
- mindspore/ops/operations/_tensor_array.py +0 -359
- mindspore/ops/operations/rl_ops.py +0 -288
- mindspore/parallel/_offload_context.py +0 -275
- mindspore/parallel/_recovery_context.py +0 -115
- mindspore/parallel/_transformer/__init__.py +0 -35
- mindspore/parallel/_transformer/layers.py +0 -765
- mindspore/parallel/_transformer/loss.py +0 -251
- mindspore/parallel/_transformer/moe.py +0 -693
- mindspore/parallel/_transformer/op_parallel_config.py +0 -222
- mindspore/parallel/_transformer/transformer.py +0 -3124
- mindspore/parallel/mpi/_mpi_config.py +0 -116
- mindspore/profiler/common/validator/validate_path.py +0 -84
- mindspore/train/memory_profiling_pb2.py +0 -298
- mindspore/utils/hooks.py +0 -81
- /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/WHEEL +0 -0
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/entry_points.txt +0 -0
- {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/top_level.txt +0 -0
|
@@ -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
|
|
@@ -521,6 +522,10 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
521
522
|
cde.deregister_worker_pids(id(self))
|
|
522
523
|
if hasattr(self, 'eof') and self.eof is not None:
|
|
523
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")
|
|
524
529
|
if hasattr(self, 'cleaning_process') and self.cleaning_process is not None:
|
|
525
530
|
# let the quit event notify the cleaning process to exit
|
|
526
531
|
self.cleaning_process.join(timeout=5)
|
|
@@ -562,7 +567,8 @@ def _main_process_already_exit(eof, is_multiprocessing, idx_queue, result_queue,
|
|
|
562
567
|
return False
|
|
563
568
|
|
|
564
569
|
|
|
565
|
-
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):
|
|
566
572
|
"""
|
|
567
573
|
Multithread or multiprocess generator worker process loop.
|
|
568
574
|
"""
|
|
@@ -570,6 +576,9 @@ def _generator_worker_loop(dataset, idx_queue, result_queue, eof, is_multiproces
|
|
|
570
576
|
cde.register_worker_handlers()
|
|
571
577
|
|
|
572
578
|
if is_multiprocessing:
|
|
579
|
+
if video_backend is not None:
|
|
580
|
+
set_video_backend(video_backend)
|
|
581
|
+
|
|
573
582
|
result_queue.cancel_join_thread() # Ensure that the process does not hang when exiting
|
|
574
583
|
|
|
575
584
|
# init the random seed and np.random seed for the subprocess
|
|
@@ -658,6 +667,9 @@ class _GeneratorWorkerMt(threading.Thread):
|
|
|
658
667
|
return False
|
|
659
668
|
return True
|
|
660
669
|
|
|
670
|
+
def queue_full(self):
|
|
671
|
+
return self.idx_queue.full()
|
|
672
|
+
|
|
661
673
|
|
|
662
674
|
class _GeneratorWorkerMp(multiprocessing.Process):
|
|
663
675
|
"""
|
|
@@ -671,8 +683,9 @@ class _GeneratorWorkerMp(multiprocessing.Process):
|
|
|
671
683
|
else:
|
|
672
684
|
self.res_queue = multiprocessing.Queue(queue_size)
|
|
673
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
|
|
674
687
|
super().__init__(target=_generator_worker_loop,
|
|
675
|
-
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),
|
|
676
689
|
name="GeneratorWorkerProcess" + str(worker_id))
|
|
677
690
|
|
|
678
691
|
def put(self, item):
|
|
@@ -698,6 +711,9 @@ class _GeneratorWorkerMp(multiprocessing.Process):
|
|
|
698
711
|
return False
|
|
699
712
|
return True
|
|
700
713
|
|
|
714
|
+
def queue_full(self):
|
|
715
|
+
return self.idx_queue.full()
|
|
716
|
+
|
|
701
717
|
def __del__(self):
|
|
702
718
|
# del all the Queue & SharedQueue when the iter had been deleted from ITERATORS_LIST
|
|
703
719
|
if hasattr(self, 'idx_queue'):
|
|
@@ -800,25 +816,6 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
800
816
|
collate_fn (Callable[List[numpy.ndarray]], optional): Define how to merge a list of data into a batch.
|
|
801
817
|
Only valid if `batch_sampler` is used. Default: ``None`` , do not use collation function.
|
|
802
818
|
|
|
803
|
-
Raises:
|
|
804
|
-
RuntimeError: If source raises an exception during execution.
|
|
805
|
-
RuntimeError: If len of column_names does not match output len of source.
|
|
806
|
-
ValueError: If `num_parallel_workers` exceeds the max thread numbers.
|
|
807
|
-
ValueError: If sampler and shuffle are specified at the same time.
|
|
808
|
-
ValueError: If sampler and sharding are specified at the same time.
|
|
809
|
-
ValueError: If `num_shards` is specified but shard_id is None.
|
|
810
|
-
ValueError: If shard_id is specified but `num_shards` is None.
|
|
811
|
-
ValueError: If `shard_id` is not in range of [0, `num_shards` ).
|
|
812
|
-
TypeError: If `batch_sampler` is not iterable.
|
|
813
|
-
ValueError: If `batch_sampler` is specified together with `num_samples` ,
|
|
814
|
-
`shuffle` , `num_shards` , `shard_id` and `sampler`.
|
|
815
|
-
TypeError: If `collate_fn` is not callable.
|
|
816
|
-
ValueError: If `collate_fn` is specified while `batch_sampler` is None.
|
|
817
|
-
|
|
818
|
-
Tutorial Examples:
|
|
819
|
-
- `Load & Process Data With Dataset Pipeline
|
|
820
|
-
<https://www.mindspore.cn/docs/en/master/api_python/samples/dataset/dataset_gallery.html>`_
|
|
821
|
-
|
|
822
819
|
.. warning::
|
|
823
820
|
`GeneratorDataset` uses `dill` module implicitly in multiprocessing `spawn` mode to serialize/deserialize
|
|
824
821
|
`source`, which is known to be insecure. It is possible to construct malicious pickle data which will
|
|
@@ -873,6 +870,21 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
873
870
|
|
|
874
871
|
.. include:: mindspore.dataset.sampler.txt
|
|
875
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
|
+
|
|
876
888
|
Examples:
|
|
877
889
|
>>> import mindspore.dataset as ds
|
|
878
890
|
>>> import numpy as np
|
|
@@ -931,6 +943,10 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
931
943
|
>>>
|
|
932
944
|
>>> # list, dict, tuple of Python is also random accessible
|
|
933
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>`_
|
|
934
950
|
"""
|
|
935
951
|
|
|
936
952
|
@check_generator_dataset
|
|
@@ -2179,7 +2179,7 @@ class ImageFolderDataset(MappableDataset, VisionBaseDataset):
|
|
|
2179
2179
|
<https://www.mindspore.cn/docs/en/master/api_python/samples/dataset/dataset_gallery.html>`_
|
|
2180
2180
|
|
|
2181
2181
|
Note:
|
|
2182
|
-
- The shape of the image column is [
|
|
2182
|
+
- The shape of the image column is [undecoded_image_size] if `decode` flag is ``False``, or [H,W,C] otherwise.
|
|
2183
2183
|
- The parameters `num_samples` , `shuffle` , `num_shards` , `shard_id` can be used to control the sampler
|
|
2184
2184
|
used in the dataset, and their effects when combined with parameter `sampler` are as follows.
|
|
2185
2185
|
|
|
@@ -1481,23 +1481,9 @@ def check_map(method):
|
|
|
1481
1481
|
@wraps(method)
|
|
1482
1482
|
def new_method(self, *args, **kwargs):
|
|
1483
1483
|
from mindspore.dataset.callback import DSCallback
|
|
1484
|
-
[operations, input_columns, output_columns,
|
|
1484
|
+
[operations, input_columns, output_columns, num_parallel_workers, param_dict], _ = \
|
|
1485
1485
|
parse_user_args(method, *args, **kwargs)
|
|
1486
1486
|
|
|
1487
|
-
if column_order is not None:
|
|
1488
|
-
raise ValueError("The parameter 'column_order' had been deleted in map operation. "
|
|
1489
|
-
"Please use '.project' operation instead.\n"
|
|
1490
|
-
">> # Usage of old api:\n"
|
|
1491
|
-
">> dataset = dataset.map(operations=PyFunc,\n"
|
|
1492
|
-
">> input_columns=[\"column_a\"],\n"
|
|
1493
|
-
">> output_columns=[\"column_b\", \"column_c\"],\n"
|
|
1494
|
-
">> column_order=[\"column_b\", \"column_c\"])\n"
|
|
1495
|
-
">> # Usage of new api:\n"
|
|
1496
|
-
">> dataset = dataset.map(operations=PyFunc,\n"
|
|
1497
|
-
">> input_columns=[\"column_a\"],\n"
|
|
1498
|
-
">> output_columns=[\"column_b\", \"column_c\"])\n"
|
|
1499
|
-
">> dataset = dataset.project([\"column_b\", \"column_c\"])")
|
|
1500
|
-
|
|
1501
1487
|
(python_multiprocessing, max_rowsize, cache, callbacks, offload) = get_map_kwargs_from_dict(param_dict)
|
|
1502
1488
|
|
|
1503
1489
|
# check whether network computing operator exist in input operations(python function)
|
|
@@ -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))
|
|
@@ -613,7 +613,7 @@ class Mask(TensorOperation):
|
|
|
613
613
|
``Relational.GT``, ``Relational.LE``, ``Relational.GE``, take ``Relational.EQ`` as example,
|
|
614
614
|
EQ refers to equal.
|
|
615
615
|
constant (Union[str, int, float, bool]): Constant to be compared to.
|
|
616
|
-
dtype (mindspore.dtype, optional): Type of the generated mask. Default: ``mstype.
|
|
616
|
+
dtype (mindspore.dtype, optional): Type of the generated mask. Default: ``mstype.bool``.
|
|
617
617
|
|
|
618
618
|
Raises:
|
|
619
619
|
TypeError: `operator` is not of type Relational.
|
|
@@ -654,7 +654,7 @@ class Mask(TensorOperation):
|
|
|
654
654
|
"""
|
|
655
655
|
|
|
656
656
|
@check_mask_op_new
|
|
657
|
-
def __init__(self, operator, constant, dtype=mstype.
|
|
657
|
+
def __init__(self, operator, constant, dtype=mstype.bool):
|
|
658
658
|
super().__init__()
|
|
659
659
|
self.operator = operator
|
|
660
660
|
self.dtype = mstype_to_detype(dtype)
|
|
@@ -1171,7 +1171,7 @@ class TypeCast(TensorOperation):
|
|
|
1171
1171
|
to be cast to.
|
|
1172
1172
|
|
|
1173
1173
|
Raises:
|
|
1174
|
-
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` .
|
|
1175
1175
|
|
|
1176
1176
|
Supported Platforms:
|
|
1177
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``
|