Pytorch giving cuda error on mac when creating a neural net
I have Python 3.8 and an installation of torch from using
pip3 install torch
When I try to create a model with 3 input dimensions, I get an error relating to cuda support.
I'm on a mac which doesn't have a GPU with cuda support. How can I prevent this error?
to reproduce:
import torch as T
import torch.nn as nn

def create(input_dims):
    return nn.Sequential(
                nn.Linear(*input_dims, 256),
                nn.ReLU(),
                nn.Linear(256, 256),
                nn.ReLU(),
                nn.Linear(256, 50),
                nn.Softmax(dim=-1)
    )

create(input_dims=(100,100))    #this works fine
create(input_dims=(100,100,3))  #this produces the error:

&quot;&quot;&quot;
Traceback (most recent call last):
  File &quot;example.py&quot;, line 15, in &lt;module&gt;
    create(input_dims=(100,100,3))
  File &quot;example.py&quot;, line 6, in create
    nn.Linear(*input_dims, 256),
  File &quot;/Users/darrinwiley/Library/Python/3.8/lib/python/site-packages/torch/nn/modules/linear.py&quot;, line 81, in __init__
    self.weight = Parameter(torch.empty((out_features, in_features), **factory_kwargs))
  File &quot;/Users/darrinwiley/Library/Python/3.8/lib/python/site-packages/torch/cuda/__init__.py&quot;, line 166, in _lazy_init
    raise AssertionError(&quot;Torch not compiled with CUDA enabled&quot;)
AssertionError: Torch not compiled with CUDA enabled
&quot;&quot;&quot;


As shown in the Pytorch docs, If you are on a mac, then Pytorch does not offer any way to install the cuda toolkit as shown in this image:

A way to solve this error is by either using some shared server that is on linux or windows or by running virtual machines.
