To print the shape of fully connected layer input and output in Matlab, you can use the size()
function. The input shape is determined by the number of input features or nodes, and the output shape is determined by the number of output nodes. Here's an example code block:
main.m523 chars16 lines
This code creates a fully connected layer with 10 input nodes and 5 output nodes using the fullyConnectedLayer
function in Matlab's Neural Network Toolbox. It then defines an input matrix of size [batchSize, inputSize], where batchSize is set to 1 for simplicity. The input matrix is passed through the fully connected layer using the predict
function, which produces an output matrix with size [batchSize, outputSize]. Finally, the code uses disp
and num2str
functions to print the shape of the input and output matrices to the command window.
gistlibby LogSnag