Thanks for reply! Here I find that your code also return the same error.
When I run your code in this way:
import torch
import torch.nn as nn
from torch.autograd import Variable
layer1=nn.Sequential(
    nn.AvgPool3d((2,1,1), stride=(2,1,1))
)
layer2_1=nn.Sequential(
    nn.Conv3d(1,64,(3,3,3),(1,1,1),(1,1,1)),
    nn.LeakyReLU(0.1),
)

layer1.double()
layer2_1.double()
inp = Variable(torch.Tensor(4,1,32,32,32).double())
out=layer1(inp)
out2=layer2_1(out)

The same bug reappears exactly in this step,and is completely the same as above I mentioned:
out2=layer2_1(out)

And I also try
out=layer2_1(inp)

and I move the nn.LeakyRelu(0.1)part of layer2_1 and try
out=layer2_1(inp)

The same mistake reappears exactly the same as above.
I haven’t try the code with .cuda(),maybe it is a mistake only on pytorch of cpu version? Or maybe I need to reinstall my pytorch system?
I’m sorry for the late apply, thanks for your attention!