I’m writing a softmax layer at the end of the model for classification but I’m not sure whether the nn.Linear layer does convolution operation and if it doesn’t then the convolution operation needs to be done.
So suppose I have 5 classes to be classified at the end and the output features of the 2nd last layer is 64*8, so should the last layer be something like this:
if(layer=="last"):
      output_channels=5
                return nn.Sequential(
                    nn.Conv2d(64*8, output_channels, kernel_size, stride, padding, bias=False),
                    nn.Linear(output_channels,output_channels),
                    nn.Softmax(dim=1)
                    )

or it should be like this:
if(layer=="last"):
      output_channels=5
                return nn.Sequential(
                    nn.Linear(64*8,output_channels),
                    nn.Softmax(dim=1)
                    )