mindspore.nn.GetNextSingleOp
- class mindspore.nn.GetNextSingleOp(dataset_types, dataset_shapes, queue_name)[source]
Cell to run for getting the next operation.
- Parameters
dataset_types (list[
mindspore.dtype
]) – The types of dataset.queue_name (str) – Queue name to fetch the data.
For detailed information, refer to ops.operations.GetNext.
- Inputs:
No inputs.
- Outputs:
tuple[Tensor], the data get from Dataset.
- Supported Platforms:
Ascend
GPU
Examples
>>> train_dataset = create_custom_dataset() >>> 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_single_op_net = nn.GetNextSingleOp(dataset_types, dataset_shapes, queue_name) >>> data, label = get_next_single_op_net() >>> relu = P.ReLU() >>> result = relu(data).asnumpy() >>> print(result.shape) (32, 1, 32, 32)