mindspore 2.7.0__cp310-cp310-win_amd64.whl → 2.7.0rc1__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 +1 -1
- 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/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -0
- mindspore/_extends/parse/parser.py +22 -28
- mindspore/_extends/parse/standard_method.py +1 -15
- mindspore/_extends/pijit/pijit_func_white_list.py +5 -2
- mindspore/_extends/remote/kernel_build_server_ascend.py +75 -0
- mindspore/amp.py +18 -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/common/__init__.py +12 -18
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +38 -102
- mindspore/common/_utils.py +1 -9
- mindspore/common/api.py +106 -155
- mindspore/common/{dynamic_shape/auto_dynamic_shape.py → auto_dynamic_shape.py} +23 -17
- mindspore/common/dtype.py +57 -98
- mindspore/common/dump.py +1 -1
- mindspore/common/file_system.py +9 -59
- mindspore/common/hook_handle.py +3 -22
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +20 -4
- mindspore/common/recompute.py +4 -2
- mindspore/common/tensor.py +52 -38
- mindspore/communication/_hccl_management.py +297 -0
- mindspore/context.py +21 -15
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +1 -35
- mindspore/dataset/engine/datasets.py +315 -330
- mindspore/dataset/engine/datasets_user_defined.py +22 -38
- 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 +5 -17
- mindspore/dataset/vision/utils.py +21 -632
- mindspore/device_context/ascend/op_tuning.py +1 -35
- mindspore/dnnl.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +0 -3
- mindspore/include/api/cell.h +4 -28
- mindspore/include/api/cfg.h +7 -24
- mindspore/include/api/context.h +0 -1
- mindspore/include/api/delegate.h +2 -0
- mindspore/include/api/dual_abi_helper.h +19 -100
- mindspore/include/api/graph.h +1 -14
- mindspore/include/api/kernel.h +3 -16
- mindspore/include/api/kernel_api.h +1 -9
- mindspore/include/api/metrics/accuracy.h +0 -9
- mindspore/include/api/model.h +1 -5
- mindspore/include/api/model_group.h +0 -4
- mindspore/include/api/model_parallel_runner.h +0 -2
- mindspore/include/api/status.h +10 -48
- mindspore/include/api/types.h +1 -6
- mindspore/include/dataset/constants.h +0 -9
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +2 -3
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -5
- 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/distributed/__init__.py +0 -4
- mindspore/mint/distributed/distributed.py +14 -217
- mindspore/mint/nn/layer/_functions.py +2 -1
- mindspore/mint/nn/layer/conv.py +6 -6
- mindspore/mint/nn/layer/normalization.py +3 -3
- mindspore/nn/cell.py +174 -216
- mindspore/nn/layer/activation.py +2 -4
- mindspore/nn/layer/basic.py +13 -7
- mindspore/nn/layer/image.py +1 -1
- mindspore/nn/optim/adam.py +3 -1
- mindspore/nn/optim/lamb.py +3 -1
- mindspore/nn/optim/tft_wrapper.py +3 -2
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/wrap/cell_wrapper.py +5 -39
- mindspore/nn/wrap/grad_reducer.py +15 -0
- mindspore/numpy/array_creations.py +2 -2
- 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_inner_ops.py +9 -0
- mindspore/ops/_op_impl/cpu/__init__.py +0 -1
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +2 -12
- mindspore/ops/auto_generate/gen_extend_func.py +4 -4
- mindspore/ops/auto_generate/gen_ops_def.py +16 -290
- mindspore/ops/auto_generate/gen_ops_prim.py +76 -563
- mindspore/ops/composite/base.py +1 -1
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/function/__init__.py +0 -1
- mindspore/ops/function/array_func.py +6 -10
- mindspore/ops/function/debug_func.py +2 -4
- mindspore/ops/function/grad/grad_func.py +12 -4
- mindspore/ops/function/math_func.py +32 -44
- mindspore/ops/function/nn_func.py +20 -18
- mindspore/ops/functional.py +1 -2
- mindspore/ops/functional_overload.py +12 -23
- mindspore/ops/operations/_inner_ops.py +12 -11
- mindspore/ops/operations/array_ops.py +50 -4
- mindspore/ops/operations/comm_ops.py +15 -1
- mindspore/ops/operations/custom_ops.py +4 -10
- mindspore/ops/operations/debug_ops.py +6 -6
- mindspore/ops/operations/manually_defined/ops_def.py +12 -12
- mindspore/ops/operations/math_ops.py +5 -5
- mindspore/ops/operations/nn_ops.py +1 -1
- mindspore/ops/primitive.py +10 -3
- mindspore/ops/tensor_method.py +7 -16
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +16 -0
- mindspore/parallel/_auto_parallel_context.py +15 -5
- mindspore/parallel/_parallel_serialization.py +2 -3
- mindspore/parallel/_ps_context.py +2 -2
- mindspore/parallel/_transformer/transformer.py +4 -4
- mindspore/parallel/_utils.py +11 -5
- mindspore/parallel/auto_parallel.py +9 -23
- mindspore/parallel/checkpoint_transform.py +0 -2
- mindspore/parallel/cluster/process_entity/_api.py +1 -4
- mindspore/parallel/cluster/run.py +3 -5
- mindspore/parallel/function/reshard_func.py +5 -6
- mindspore/parallel/nn/parallel_cell_wrapper.py +3 -40
- mindspore/parallel/nn/parallel_grad_reducer.py +8 -0
- mindspore/parallel/shard.py +21 -7
- mindspore/parallel/transform_safetensors.py +4 -10
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +9 -10
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +1 -1
- mindspore/profiler/common/msprof_cmd_tool.py +2 -2
- mindspore/profiler/common/path_manager.py +0 -9
- mindspore/profiler/common/profiler_context.py +2 -25
- mindspore/profiler/common/profiler_meta_data.py +0 -1
- mindspore/profiler/common/profiler_op_analyse.py +6 -10
- mindspore/{ops/_op_impl/cpu/joinedstr_op.py → profiler/common/validator/__init__.py} +1 -15
- mindspore/profiler/common/validator/validate_path.py +84 -0
- mindspore/profiler/dynamic_profiler.py +46 -91
- mindspore/profiler/envprofiler.py +5 -30
- mindspore/profiler/experimental_config.py +1 -16
- mindspore/profiler/platform/cpu_profiler.py +4 -10
- mindspore/profiler/platform/npu_profiler.py +1 -1
- mindspore/profiler/profiler.py +145 -193
- 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/runtime/__init__.py +4 -6
- mindspore/runtime/executor.py +0 -27
- mindspore/runtime/memory.py +0 -1
- 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/train/_utils.py +3 -3
- mindspore/train/amp.py +3 -0
- mindspore/train/callback/_callback.py +1 -2
- mindspore/train/callback/_checkpoint.py +8 -1
- mindspore/train/callback/_flops_collector.py +6 -10
- mindspore/train/callback/_train_fault_tolerance.py +7 -3
- mindspore/train/data_sink.py +4 -4
- mindspore/train/dataset_helper.py +5 -5
- mindspore/train/model.py +20 -4
- mindspore/train/serialization.py +15 -35
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/hooks.py +81 -0
- mindspore/utils/utils.py +8 -8
- mindspore/version.py +1 -1
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/METADATA +1 -1
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +193 -192
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +0 -1109
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/dynamic_shape/enable_dynamic.py +0 -197
- /mindspore/common/{dynamic_shape/_auto_dynamic.py → _auto_dynamic.py} +0 -0
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -48,8 +48,7 @@ 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
|
|
52
|
-
set_video_backend
|
|
51
|
+
get_enable_watchdog, get_debug_mode, get_seed, set_seed, get_multiprocessing_start_method
|
|
53
52
|
from ..core.datatypes import mstypelist_to_detypelist
|
|
54
53
|
from ..core.py_util_helpers import ExceptionHandler
|
|
55
54
|
from ..core.validator_helpers import type_check
|
|
@@ -522,10 +521,6 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
522
521
|
cde.deregister_worker_pids(id(self))
|
|
523
522
|
if hasattr(self, 'eof') and self.eof is not None:
|
|
524
523
|
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")
|
|
529
524
|
if hasattr(self, 'cleaning_process') and self.cleaning_process is not None:
|
|
530
525
|
# let the quit event notify the cleaning process to exit
|
|
531
526
|
self.cleaning_process.join(timeout=5)
|
|
@@ -567,8 +562,7 @@ def _main_process_already_exit(eof, is_multiprocessing, idx_queue, result_queue,
|
|
|
567
562
|
return False
|
|
568
563
|
|
|
569
564
|
|
|
570
|
-
def _generator_worker_loop(dataset, idx_queue, result_queue, eof, is_multiprocessing, worker_id, ppid=-1
|
|
571
|
-
video_backend=None):
|
|
565
|
+
def _generator_worker_loop(dataset, idx_queue, result_queue, eof, is_multiprocessing, worker_id, ppid=-1):
|
|
572
566
|
"""
|
|
573
567
|
Multithread or multiprocess generator worker process loop.
|
|
574
568
|
"""
|
|
@@ -576,9 +570,6 @@ def _generator_worker_loop(dataset, idx_queue, result_queue, eof, is_multiproces
|
|
|
576
570
|
cde.register_worker_handlers()
|
|
577
571
|
|
|
578
572
|
if is_multiprocessing:
|
|
579
|
-
if video_backend is not None:
|
|
580
|
-
set_video_backend(video_backend)
|
|
581
|
-
|
|
582
573
|
result_queue.cancel_join_thread() # Ensure that the process does not hang when exiting
|
|
583
574
|
|
|
584
575
|
# init the random seed and np.random seed for the subprocess
|
|
@@ -667,9 +658,6 @@ class _GeneratorWorkerMt(threading.Thread):
|
|
|
667
658
|
return False
|
|
668
659
|
return True
|
|
669
660
|
|
|
670
|
-
def queue_full(self):
|
|
671
|
-
return self.idx_queue.full()
|
|
672
|
-
|
|
673
661
|
|
|
674
662
|
class _GeneratorWorkerMp(multiprocessing.Process):
|
|
675
663
|
"""
|
|
@@ -683,9 +671,8 @@ class _GeneratorWorkerMp(multiprocessing.Process):
|
|
|
683
671
|
else:
|
|
684
672
|
self.res_queue = multiprocessing.Queue(queue_size)
|
|
685
673
|
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
|
|
687
674
|
super().__init__(target=_generator_worker_loop,
|
|
688
|
-
args=(dataset, self.idx_queue, self.res_queue, eof, True, worker_id, ppid
|
|
675
|
+
args=(dataset, self.idx_queue, self.res_queue, eof, True, worker_id, ppid),
|
|
689
676
|
name="GeneratorWorkerProcess" + str(worker_id))
|
|
690
677
|
|
|
691
678
|
def put(self, item):
|
|
@@ -711,9 +698,6 @@ class _GeneratorWorkerMp(multiprocessing.Process):
|
|
|
711
698
|
return False
|
|
712
699
|
return True
|
|
713
700
|
|
|
714
|
-
def queue_full(self):
|
|
715
|
-
return self.idx_queue.full()
|
|
716
|
-
|
|
717
701
|
def __del__(self):
|
|
718
702
|
# del all the Queue & SharedQueue when the iter had been deleted from ITERATORS_LIST
|
|
719
703
|
if hasattr(self, 'idx_queue'):
|
|
@@ -816,6 +800,25 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
816
800
|
collate_fn (Callable[List[numpy.ndarray]], optional): Define how to merge a list of data into a batch.
|
|
817
801
|
Only valid if `batch_sampler` is used. Default: ``None`` , do not use collation function.
|
|
818
802
|
|
|
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
|
+
|
|
819
822
|
.. warning::
|
|
820
823
|
`GeneratorDataset` uses `dill` module implicitly in multiprocessing `spawn` mode to serialize/deserialize
|
|
821
824
|
`source`, which is known to be insecure. It is possible to construct malicious pickle data which will
|
|
@@ -870,21 +873,6 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
870
873
|
|
|
871
874
|
.. include:: mindspore.dataset.sampler.txt
|
|
872
875
|
|
|
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
|
-
|
|
888
876
|
Examples:
|
|
889
877
|
>>> import mindspore.dataset as ds
|
|
890
878
|
>>> import numpy as np
|
|
@@ -943,10 +931,6 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
943
931
|
>>>
|
|
944
932
|
>>> # list, dict, tuple of Python is also random accessible
|
|
945
933
|
>>> 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>`_
|
|
950
934
|
"""
|
|
951
935
|
|
|
952
936
|
@check_generator_dataset
|
|
@@ -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 :class:`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
|
-
|
|
57
|
+
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 :class:`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 :class:`numpy.ndarray` .
|
|
579
|
+
TypeError: If `mean_vector` is not of type :class:`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 :class:`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 :class:`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 :class:`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 :class:`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 :class:`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 :class:`numpy.ndarray` .
|
|
2763
|
+
TypeError: If `mean_vector` is not of type :class:`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 :class:`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 :class:`numpy.ndarray` .
|
|
6979
6979
|
TypeError: If dimension of the input image is not 2 or 3.
|
|
6980
6980
|
|
|
6981
6981
|
Supported Platforms:
|
|
@@ -7025,18 +7025,6 @@ 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
|
-
|
|
7040
7028
|
|
|
7041
7029
|
class ToType(TypeCast):
|
|
7042
7030
|
"""
|
|
@@ -7053,7 +7041,7 @@ class ToType(TypeCast):
|
|
|
7053
7041
|
such as ``numpy.float32`` .
|
|
7054
7042
|
|
|
7055
7043
|
Raises:
|
|
7056
|
-
TypeError: If `data_type` is not of type :class:`mindspore.dtype` or
|
|
7044
|
+
TypeError: If `data_type` is not of type :class:`mindspore.dtype` or :class:`numpy.dtype` .
|
|
7057
7045
|
|
|
7058
7046
|
Supported Platforms:
|
|
7059
7047
|
``CPU`` ``GPU`` ``Ascend``
|