mindspore.dataset.transforms.Duplicate

class mindspore.dataset.transforms.Duplicate[source]

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

Raises

RuntimeError – If given tensor has two columns.

Supported Platforms:

CPU

Examples

>>> # Data before
>>> # |  x      |
>>> # +---------+
>>> # | [1,2,3] |
>>> # +---------+
>>> data = [[1,2,3]]
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data, ["x"])
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms.Duplicate(),
...                                                 input_columns=["x"],
...                                                 output_columns=["x", "y"])
>>> # Data after
>>> # |  x      |  y      |
>>> # +---------+---------+
>>> # | [1,2,3] | [1,2,3] |
>>> # +---------+---------+