init(unsafeUninitializedShape:scalarType:initializingWith:)
Creates a tensor with the specified shape, then calls the given closure with a buffer covering the tensor’s uninitialized memory.
Declaration
init(unsafeUninitializedShape shape: [Int], scalarType: any MLTensorScalar.Type, initializingWith initializer: (UnsafeMutableRawBufferPointer) throws -> Void) rethrowsParameters
- shape:
The dimensions of the tensor.
- scalarType:
The scalar type.
- initializer:
A closure which will be called to initialize the underlying memory of the tensor. Scalars expected to be stored contiguously in first-major order.
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:data:scalarType:)