One Logo Pool Ball
Accelerate · IOS API REFERENCE

BNNS.FullyConnectedLayer

class · iOS 14.0+ · SDK 27.1

class FullyConnectedLayer

A fully connected layer.

Members (2)

init · iOS 14.0+

init

TypeScript
static init(input: BNNSNDArrayDescriptor, output: BNNSNDArrayDescriptor, weights: BNNSNDArrayDescriptor, bias: (BNNSNDArrayDescriptor) | null, activation: BNNS_ActivationFunction, filterParameters?: (BNNSFilterParameters) | null): (BNNS_FullyConnectedLayer) | null
Swift declaration
convenience init?(input: BNNSNDArrayDescriptor, output: BNNSNDArrayDescriptor, weights: BNNSNDArrayDescriptor, bias: BNNSNDArrayDescriptor?, activation: BNNS.ActivationFunction, filterParameters: BNNSFilterParameters? = nil)

Creates a new fully connected layer. - Parameter input: The input descriptor. - Parameter output: The output descriptor. - Parameter weights: The weights descriptor. - Parameter bias: The bias descriptor. - Parameter activation: The activation function. - Parameter filterParameters: Runtime filter parameters.

static · iOS 16.0+

sparsify

TypeScript
static sparsify(batchSize: number, layout: BNNS_SparseLayout, inputDenseShape: BNNSNDArrayDescriptor, inputValues: BNNSNDArrayDescriptor, output: BNNSNDArrayDescriptor, sparseParameters?: (BNNS_SparseParameters) | null, workspace?: (ArrayBuffer) | null, filterParameters?: (BNNSFilterParameters) | null): { $ret: null; $out: { "output": BNNSNDArrayDescriptor } }
Swift 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

Converts a sparse tensor from a standardized sparse layout to a device specific sparse layout used by FullyConnected - Parameter batchSize: The number of input-output pairs to process. - Parameter inputDenseShape: The dense shape of the sparse 2D input. You must define the sizes and layout. - Parameter inputLayout: The layout and nonzero indices of the sparse input. - Parameter output: The destination array descriptor that contains the output device optimized BNNS Sparse Fully Connected weights. If the output's `data` is `nil`, BNNS allocates the memory, otherwise, you may preallocate this memory to the size of the dense input ( use `BNNSNDArrayDescriptor.getter:dataSize` to calculate this value). - Parameter sparseParameters: An optional data structure that provides a hint to the sparsity function. - Parameter workspace: An optional pointer to a memory region that the function uses as scratch space. Set this to `nil` to have BNNS allocate scratch space, otherwise, you must provide a buffer at least equal to the size of the dense input. - seealso: `BNNSNDArrayFullyConnectedSparsifySparseCOO`. - seealso: `BNNSNDArrayFullyConnectedSparsifySparseCSR`.

Omit the output parameters from the call. The result contains $ret and $out, with output inside $out.

Skipped declarations

No declarations were skipped in this snapshot.

All Accelerate types →