Contents

flattened()

Reshape to a one-dimensional tensor.

Declaration

func flattened() -> MLTensor

Discussion

For example:

let x = MLTensor(shape: [2, 2], scalars: [1, 2, 3, 4], scalarType: Float.self)
let y = x.flattened()
y.shape // is [4]

See Also

Reshaping the tensor