Flatten

Description

Flattens the input tensor into a 2D matrix. If the shape of the input tensor is (d_0, d_1, ...d_n), the output shape is (d_0 * d_1...d_axis-1, d_axis *...* dn).

Input

input: input tensor. The rank is greater than 2. The data type can be float16 or float.

Attribute

axis: int. The default value is 1. It specifies an input dimension (excluded) to be tiled to the external dimension of the output. The value of axis must be within the range of [-r, r], where r is the rank of the input tensor. A negative value indicates that the size is calculated from the end. When axis is 0, the shape of the output tensor is (1, (d_0 * d_1...d_n)), and the shape of the input tensor is (d_0, d_1, ...d_n).

Output

output: 2D tensor with the content of the input tensor.

Constraints

None.

ONNX Opset Support

Opset v8/v9/v10/v11/v12/v13/v14/v15/v16/v17/v18