mindspore.dataset.Dataset.output_shapes

Dataset.output_shapes(estimate=False)[source]

Get the shapes of output data.

Parameters

estimate (bool) – If estimate is False , will return the shapes of first data row. Otherwise, will iterate the whole dataset and return the estimated shapes of data row, where dynamic shape is marked as None (used in dynamic data shapes scenario). Default: False .

Returns

list, list of shapes of each column.

Examples

>>> import mindspore.dataset as ds
>>> import numpy as np
>>>
>>> def generator1():
...     for i in range(1, 100):
...         yield np.ones((16, 83, 83)), np.array([i])
>>>
>>> dataset = ds.GeneratorDataset(generator1, ["data1", "data2"])
>>> output_shapes = dataset.output_shapes()
>>> print(output_shapes)
[[16, 83, 83], [1]]