makeTensor(descriptor:offset:)
Creates a tensor that shares storage with this buffer.
Declaration
func makeTensor(descriptor: MTLTensorDescriptor, offset: Int) throws -> any MTLTensorParameters
- descriptor:
A description of the properties for the new tensor.
- offset:
Offset into the buffer at which the data of the tensor begins.
Return Value
The created MTLTensor instance, or nil if the function failed.
Discussion
offset must be 0 when usage contains machineLearning.
When dataType is a sub-byte MTLTensorDataType, offset must be aligned to 128 bytes. Although only required for sub-byte types, applying 128-byte alignment for all MTLTensorDataType values improves performance.
See MTLTensorDescriptor for more information.