Extracting the center neuron of a channel from a Conv2d layer an is pretty straightforward and simple:
# Extract center neuron of Conv2d channel x = input.size(2) // 2 y = input.size(3) // 2 input = input[:, channel, y:y+1, x:x+1] # (B, C, H, W)
But it appears like the same technique does not work for Linear layer channels/features as there is nothing after the channel to crop:
input = input[:, channel] # (B, C)
Is there a way to extract neurons from Linear layer channels/features?