seeker_after_truth
seeker_after_truth

Reputation: 497

Segfault in pytorch on M1: torch.from_numpy(X).float()

I'm using an M1.

I'm trying to use pytorch for a conv net.

I have a numpy array that I'm trying to turn into a torch tensor.

When I call

torch.from_numpy(X)

pytorch throws an error that it got a double when it expected a float.

When I call

torch.from_numpy(X).float() on a friends computer, everything is fine.

But when I call this command on my computer, I get a segfault.

Has anyone seen this / know what might be happening / know how to fix?

Upvotes: 1

Views: 1559

Answers (1)

murse
murse

Reputation: 31

What's your pytorch vision? I've encountered the same problem on my Macbook Pro M1, and my pytorch version is 1.12.0 at first. The I downgraded it to version 1.10.0 and the problem is solved. I suspect this has something to do with the compatibility with M1 in newer torch versions.

Actually I first uninstalled torch using pip3 uninstall torch and then reinstalled with pip3 install torch==1.10.0

But if you are using torchvision or some other affiliated packages, you may also need to downgrade them too.

Upvotes: 3

Related Questions