Contents

sparsify(batchSize:inputLayout:inputDenseShape:inputValues:output:sparseParameters:workspace:filterParameters:)

Converts a sparse tensor from a standardized sparse layout to a device-specific sparse layout that Fully Connected uses.

Declaration

static func sparsify(batchSize: Int = 1, inputLayout layout: BNNS.SparseLayout, inputDenseShape: BNNSNDArrayDescriptor, inputValues: BNNSNDArrayDescriptor, output: inout BNNSNDArrayDescriptor, sparseParameters: BNNS.SparseParameters? = nil, workspace: UnsafeMutableRawBufferPointer? = nil, filterParameters: BNNSFilterParameters? = nil) throws

Parameters

  • batchSize:

    The number of input-output pairs to process.

  • layout:

    The layout and nonzero indices of the sparse input.

  • inputDenseShape:

    The dense shape of the sparse 2D input.

  • inputValues:

    A 1D array descriptor that contains the nonzero input values.

  • output:

    The destination array descriptor that contains the output-device-optimized BNNS Sparse Fully Connected weights.

  • sparseParameters:

    An optional data structure that provides a hint to the sparsity function.

  • workspace:

    An optional pointer to a memory region that the function uses as scratch space.

  • filterParameters:

    The runtime filter parameters.

See Also

Sparse layers