flattened()
Reshape to a one-dimensional tensor.
Declaration
func flattened() -> MLTensorDiscussion
For example:
let x = MLTensor(shape: [2, 2], scalars: [1, 2, 3, 4], scalarType: Float.self)
let y = x.flattened()
y.shape // is [4]Reshape to a one-dimensional tensor.
func flattened() -> MLTensorFor example:
let x = MLTensor(shape: [2, 2], scalars: [1, 2, 3, 4], scalarType: Float.self)
let y = x.flattened()
y.shape // is [4]