Pytorch error Illegal instruction (core dumped)












1














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



gcc location.



(data-science) sam@sam-Lenovo-G51-35:~/code/data science projects/pytorch$ which gcc
/usr/bin/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[0], 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)









share|improve this question
























  • Can you make a new conda environment and reinstall pytorch and test your code, because I have faced similar core dumped issue and reinstalling in a fresh environment fixed the issue.
    – papabiceps
    Nov 19 '18 at 11:42










  • the thing is I'm not using conda but pip, I want to see if I can do this without using conda if not I'll try it with conda
    – Samuel M.
    Nov 20 '18 at 7:19
















1














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



gcc location.



(data-science) sam@sam-Lenovo-G51-35:~/code/data science projects/pytorch$ which gcc
/usr/bin/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[0], 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)









share|improve this question
























  • Can you make a new conda environment and reinstall pytorch and test your code, because I have faced similar core dumped issue and reinstalling in a fresh environment fixed the issue.
    – papabiceps
    Nov 19 '18 at 11:42










  • the thing is I'm not using conda but pip, I want to see if I can do this without using conda if not I'll try it with conda
    – Samuel M.
    Nov 20 '18 at 7:19














1












1








1







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



gcc location.



(data-science) sam@sam-Lenovo-G51-35:~/code/data science projects/pytorch$ which gcc
/usr/bin/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[0], 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)









share|improve this question















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



gcc location.



(data-science) sam@sam-Lenovo-G51-35:~/code/data science projects/pytorch$ which gcc
/usr/bin/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[0], 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)






python neural-network pytorch






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 5:48









Milo Lu

1,60311327




1,60311327










asked Nov 18 '18 at 8:21









Samuel M.Samuel M.

486426




486426












  • Can you make a new conda environment and reinstall pytorch and test your code, because I have faced similar core dumped issue and reinstalling in a fresh environment fixed the issue.
    – papabiceps
    Nov 19 '18 at 11:42










  • the thing is I'm not using conda but pip, I want to see if I can do this without using conda if not I'll try it with conda
    – Samuel M.
    Nov 20 '18 at 7:19


















  • Can you make a new conda environment and reinstall pytorch and test your code, because I have faced similar core dumped issue and reinstalling in a fresh environment fixed the issue.
    – papabiceps
    Nov 19 '18 at 11:42










  • the thing is I'm not using conda but pip, I want to see if I can do this without using conda if not I'll try it with conda
    – Samuel M.
    Nov 20 '18 at 7:19
















Can you make a new conda environment and reinstall pytorch and test your code, because I have faced similar core dumped issue and reinstalling in a fresh environment fixed the issue.
– papabiceps
Nov 19 '18 at 11:42




Can you make a new conda environment and reinstall pytorch and test your code, because I have faced similar core dumped issue and reinstalling in a fresh environment fixed the issue.
– papabiceps
Nov 19 '18 at 11:42












the thing is I'm not using conda but pip, I want to see if I can do this without using conda if not I'll try it with conda
– Samuel M.
Nov 20 '18 at 7:19




the thing is I'm not using conda but pip, I want to see if I can do this without using conda if not I'll try it with conda
– Samuel M.
Nov 20 '18 at 7:19












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359056%2fpytorch-error-illegal-instruction-core-dumped%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359056%2fpytorch-error-illegal-instruction-core-dumped%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?