In a convolutional module many parameters may alter the dimensionality of the input. Is there any way to get the dimensionality of the output of the convolutional module, or in general of any module?
I tried looking at the methods exposed in SpatialConvolution
but there are none that suggest giving me that information.
Moreover, the output tensor seems to have these dimensions:
conv1 = nn.SpatialConvolution(3, 96, 5, 5, 1, 1, 2, 2)
conv1.id = 'conv1'
print(conv1.output:size())
[torch.LongStorage of size 0]
any ideas?
I realize that I didn't even set the input dimensionality, except for the number of channels (that would be 3x32x32
). How to set it? Why is it not mandatory?
The output size depends on your input size. You can try something like this:
th> require 'nngraph'
th> conv1 = nn.SpatialConvolution(3, 96, 5, 5, 1, 1, 2, 2)()
th> model = nn.gModule({conv1},{conv1})
th> x = torch.rand(3,20,20)
th> y = model:forward(x)
th> y:size()
96
20
20
[torch.LongStorage of size 3]