init(shape:data:scalarType:)
Creates a tensor by copying the given block of data.
Declaration
init(shape: [Int], data: Data, scalarType: any MLTensorScalar.Type)Parameters
- shape:
The shape of the tensor.
- data:
The block of data that holds the contents of the tensor whose data is expected to zero-offset, stored in a C-contiguous (aka row major) way, and alignment to match the alignment of the scalar type.
- scalarType:
The scalar type.
See Also
Creating a tensor
init(_:)init(_:alongAxis:)init(_:scalarType:)init(bytesNoCopy:shape:scalarType:deallocator:)init(concatenating:alongAxis:)init(linearSpaceFrom:through:count:)init(linearSpaceFrom:through:count:scalarType:)init(ones:scalarType:)init(randomNormal:mean:standardDeviation:seed:scalarType:)init(randomUniform:in:seed:scalarType:)init(rangeFrom:to:by:)init(rangeFrom:to:by:scalarType:)init(repeating:shape:)init(repeating:shape:scalarType:)init(shape:scalars:)