It is amazing that I can pass a Tensor to nn.AvgPool1d().forward() and get Variable

a = nn.AvgPool1d(2)
b = torch.randn(2,2,2)
c = a(b)

The above code works. BTW, c's type is Variable now. The same thing can happen on F.softmax too.

I thought nn.Module/torch.nn.functional can accept Variable only.

What version of pytorch are you running?
On master this appears to be fixed:


Glad to see that it is fixed.