I have figured out the error… The size arguments for tensor.expand shouldn’t be passed within a list, i.e., you should use h_expand = h_relu.expand(64, H, h, w).contiguous().view(64, -1) instead of h_expand = h_relu.expand([64, H, h, w]).contiguous().view(64, -1).
It’s strange that forward doesn’t throw an exception…