mindspore.ops.GetNext
- class mindspore.ops.GetNext(types, shapes, output_num, shared_name)[source]
Returns the next element in the dataset queue.
Note
The GetNext operation needs to be associated with network and it also depends on the 'dataset' interface, For example, please refer to
mindspore.dataset.MnistDataset
. it can't be used directly as a single operation. For details, please refer tomindspore.connect_network_with_dataset
source code.- Parameters
- Inputs:
No inputs.
- Outputs:
tuple[Tensor], the output of dataset. The shape is described in shapes and the type is described in types.
- Supported Platforms:
Ascend
GPU
Examples
>>> import mindspore >>> from mindspore import ops >>> from mindspore import dataset as ds >>> from mindspore import dtype as mstype >>> data_path = "/path/to/MNIST_Data/train/" >>> train_dataset = ds.MnistDataset(data_path, num_samples=10) >>> dataset_helper = mindspore.DatasetHelper(train_dataset, dataset_sink_mode=True) >>> dataset = dataset_helper.iter.dataset >>> dataset_types, dataset_shapes = dataset_helper.types_shapes() >>> queue_name = dataset.__transfer_dataset__.queue_name >>> get_next = ops.GetNext(dataset_types, dataset_shapes, len(dataset_types), queue_name) >>> data, label = get_next() >>> relu = ops.ReLU() >>> result = relu(data.astype(mstype.float32)) >>> print(result.shape) (28, 28, 1)