I have install pytorch version ‘0.4.1’
I installed it directly with pip without conda, I’ve also noted the issue is with the binary and from my research on processor incompatibility with C -> gcc version.
My version of gcc is 7.3.0
And my processor type AMD A8-7410 APU with AMD Radeon R5 Graphics
and gcc location.
(data-science) sam@sam-Lenovo-G51-35:~/code/data science projects/pytorch$ which gcc
This is how I get my error.
The following code runs…
from torchvision import datasets, transforms from torch import nn import torch import torch.nn.functional as F # Define a transform to normalize the data transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)), ]) # Download and load the training data trainset = datasets.MNIST('MNIST_data/', download=True, train=True, transform=transform) trainloader = torch.utils.data.DataLoader(trainset, batch_size=64, shuffle=True) dataiter = iter(trainloader) images, labels = dataiter.next() class Network(nn.Module): def __init__(self): super(Network, self).__init__() # Defining the layers, 128, 64, 10 units each self.fc1 = nn.Linear(784, 128) self.fc2 = nn.Linear(128, 64) # Output layer, 10 units - one for each digit self.fc3 = nn.Linear(64, 10) def forward(self, x): ''' Forward pass through the network, returns the output logits ''' x = self.fc1(x) x = F.relu(x) x = self.fc2(x) x = F.relu(x) x = self.fc3(x) x = F.softmax(x, dim=1) return x # Create the network and look at it's text representation model = Network() # print(model.fc1.weight) # print(model.fc1.bias) # Set biases to all zeros model.fc1.bias.data.fill_(0) # sample from random normal with standard dev = 0.01 model.fc1.weight.data.normal_(std=0.01) # Grab some data dataiter = iter(trainloader) images, labels = dataiter.next() # Resize images into a 1D vector, new shape is (batch size, color channels, image pixels) images.resize_(64, 1, 784) # or images.resize_(images.shape, 1, 784) to automatically get batch size
all of this successfully.
But when I run this other line
# Forward pass through the network img_idx = 0 ps = model.forward(images[img_idx,:])
I get this error
Illegal instruction (core dumped)