torchsummary : RuntimeError: Expected 5-dimensional input for 5-dimensional weight but...

torchsummary :
RuntimeError: Expected 5-dimensional input for 5-dimensional weight [24, 1, 3, 3, 3], but got input of size [2, 1, 1,16,256,256] instead.
Solve:

  1. device = torch.device(“cuda”)#necessary for torchsummary, must to cuda
  2. summary(net, input_size=(1,16,256,256))#must remove the number of N
def test():
	device = torch.device("cuda")#necessary for torchsummary, must to cuda
	net = PiaNet().to(device)

	# input = torch.randn(1,1,16,256,256)
	# out = net(input)
	# print(out.shape)

	from torchsummary import summary
	summary(net, input_size=(1,16,256,256))#must remove the number of N

你可能感兴趣的:(Debug)