A fully connected convolution layer, also known as an inner product layer.
- iOS 10.0+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 10.0+
- Metal Performance Shaders
A fully connected layer in a Convolutional Neural Network (CNN) is one where every input channel is connected to every output channel. The kernel width is equal to the width of the source image, and the kernel height is equal to the height of the source image. The width and height of the output is
1 x 1.
A fully connected layer takes an
MPSImage object with dimensions
source, convolves it with
1 x 1 x No output.
Thus, the following conditions must be true:
Width == source .width
Height == source .height
Rect .size .width == 1
Rect .size .height == 1
You can think of a fully connected layer as a matrix multiplication where the image is flattened into a vector of length
source, and the weights are arranged in a matrix of dimension
No x (source to produce an output vector of length
The value of the strideInPixelsX,
groups properties must be
offset property is not applicable and it is ignored. Because the clip rectangle is clamped to the destination image bounds, if the destination is
1 x 1, you do not need to set the