mindspore.dataset.transforms

This module is to support common data augmentations. Some operations are implemented in C++ to provide high performance. Other operations are implemented in Python including using NumPy.

Common imported modules in corresponding API examples are as follows:

import mindspore.dataset as ds
import mindspore.dataset.transforms as transforms

Note: Legacy c_transforms and py_transforms are deprecated but can still be imported as follows:

from mindspore.dataset.transforms import c_transforms
from mindspore.dataset.transforms import py_transforms

See Common Data Processing and Augmentation tutorial for more details.

Descriptions of common data processing terms are as follows:

  • TensorOperation, the base class of all data processing operations implemented in C++.

  • PyTensorOperation, the base class of all data processing operations implemented in Python.

Transforms

mindspore.dataset.transforms.Compose

Compose a list of transforms into a single transform.

mindspore.dataset.transforms.Concatenate

Tensor operation that concatenates all columns into a single tensor, only 1D tenspr is supported.

mindspore.dataset.transforms.Duplicate

Duplicate the input tensor to output, only support transform one column each time.

mindspore.dataset.transforms.Fill

Tensor operation to fill all elements in the tensor with the specified value.

mindspore.dataset.transforms.Mask

Mask content of the input tensor with the given predicate.

mindspore.dataset.transforms.OneHot

Tensor operation to apply one hot encoding.

mindspore.dataset.transforms.PadEnd

Pad input tensor according to pad_shape, input tensor needs to have same rank.

mindspore.dataset.transforms.RandomApply

Randomly perform a series of transforms with a given probability.

mindspore.dataset.transforms.RandomChoice

Randomly select one transform from a list of transforms to perform operation.

mindspore.dataset.transforms.RandomOrder

Perform a series of transforms to the input image in a random order.

mindspore.dataset.transforms.Slice

Slice operation to extract a tensor out using the given n slices.

mindspore.dataset.transforms.TypeCast

Tensor operation to cast to a given MindSpore data type or NumPy data type.

mindspore.dataset.transforms.Unique

Perform the unique operation on the input tensor, only support transform one column each time.

Utilities

mindspore.dataset.transforms.Relational

Relationship operator.