mindspore.ops.Flatten

class mindspore.ops.Flatten[source]

Flattens a tensor without changing its batch size on the 0-th axis.

Refer to mindspore.ops.flatten() for more details.

Supported Platforms:

Ascend GPU CPU

Examples

>>> input_x = Tensor(np.ones(shape=[1, 2, 3, 4]), mindspore.float32)
>>> flatten = ops.Flatten()
>>> output = flatten(input_x)
>>> print(output.shape)
(1, 24)