When I feed data into my network, this error occurs. Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
I wanted to feed numpy.ndarray data, but TypeError: conv2d(): argument 'input' (position 1) must be Tensor, not numpy.ndarray
error occurs. so I changed my input_image to input_image = Variable(torch.from_numpy(input_image).cuda())
input_image.shape is (64, 3, 28, 28) and type is torch.Tensor.
Here is my network
class Network(nn.Module):
def __init__(self):
super(Network, self).__init__()
self.net= nn.Sequential(
nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5),
nn.ReLU(),
nn.MaxPool2d(kernel_size=2),
nn.Conv2d(in_channels=32, out_channels=48, kernel_size=5),
nn.ReLU(),
nn.MaxPool2d(kernel_size=2)
)
def forward(self, x):
x = self.net(x)
x = x.view(-1, 7 * 7 * 48)
return x
@ptrblck
Thanks for for tell me about MISMATCH of size.
Your example works fine but in my code, there is still something wrong.
I think It is problem of cuda().
I want to use GPU so I add cuda() like this
model = Network().cuda()
model = Network().train()
x = torch.randn(64, 3, 28, 28)
output = model(x)
this code give RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #2 'weight'
so I changed to x = torch.randn(64, 3, 28, 28)
to x = Variable(torch.randn(64, 3, 28, 28).cuda())
and It occurs Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
Which PyTorch version are you using?
As you are using Variables it seems your version might be < 0.4.0.
If so, could you first update to the latest stable release, if that’s possible?
You can find the install instructions on the website.
Call train.train() in main.py got Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
and just call train() in train.py, It works.
What the heck!?
Actually, now I’m trying to converting tensorflow codes to pytorch.
I want to use all pytorch. but in Pytorch MNIST, train set and validation set is combined, and I don`t know how can split them exactly same as tensorflow.
As I know, in pytorch number of MNIST train, test set : [60000, 10000]
and in tensorflow, number of train, test, validation set : [55000, 10000, 5000]
so I tried with tensorflow MNIST dataset.