mindspore.dataset.transforms.py_transforms.OneHotOp
- class mindspore.dataset.transforms.py_transforms.OneHotOp(num_classes, smoothing_rate=0.0)[source]
Apply one hot encoding transformation to the input label, make label be more smoothing and continuous.
- Parameters
Examples
>>> # Assume that dataset has 10 classes, thus the label ranges from 0 to 9 >>> transforms_list = [py_transforms.OneHotOp(num_classes=10, smoothing_rate=0.1)] >>> transform = py_transforms.Compose(transforms_list) >>> mnist_dataset = mnist_dataset.map(input_columns=["label"], operations=transform)