init(buffer:descriptor:)
Initializes a matrix with a buffer.
Declaration
init(buffer: any MTLBuffer, descriptor: MPSMatrixDescriptor)Parameters
- buffer:
The buffer that stores the matrix data.
- descriptor:
The matrix descriptor.
Return Value
A valid MPSMatrix object or nil, if failure.
Discussion
The dimensions and stride of the matrix are specified by the MPSMatrixDescriptor object. The size of the provided MTLBuffer object must be large enough to store the following amount of bytes:
(descriptor.rows-1) * descriptor.rowBytes + descriptor.columns * (element size)