Contents

init(shape:scalars:scalarType:)

Creates a tensor with the specified shape and contiguous scalars in row-major order.

Declaration

init<Scalar>(shape: [Int], scalars: some Collection, scalarType: Scalar.Type = Scalar.self) where Scalar : MLTensorScalar

Parameters

  • shape:

    The dimensions of the tensor.

  • scalars:

    The scalar contents of the tensor. The product of the dimensions of the shape must equal the number of scalars.

  • scalarType:

    The scalar type.

See Also

Creating a tensor