RuntimeError: [enforce fail at CPUAllocator.cpp:68]

I am new in Pytorch. I got this error when I was trying to train the GCN model on my custom dataset.

The error:

RuntimeError                              Traceback (most recent call last)
/tmp/ipykernel_61/ in <module>
     30 # Run for 200 epochs (range is exclusive in the upper bound)
     31 for epoch in range(1, 201):
---> 32     train()
     33     train_acc = test(train_loader)
     34     test_acc = test(test_loader)

/tmp/ipykernel_61/ in train()
     10     for data in train_loader:
     11       print('x_shape:',data.x.shape)
---> 12       out = model(data.x.float(), data.edge_index, data.batch)
     13       loss = criterion(out, data.num_classes)
     14       loss.backward()

RuntimeError: [enforce fail at CPUAllocator.cpp:68] . DefaultCPUAllocator: can't allocate memory: you tried to allocate 8609587200 bytes. Error code 12 (Cannot allocate memory)

My code:

train_loader = DataLoader(trainset, batch_size=64, shuffle=True)
test_loader = DataLoader(testset, batch_size=64, shuffle=False)

# Define our GCN class as a pytorch Module
class GCN(torch.nn.Module):
    def __init__(self, hidden_channels):
        super(GCN, self).__init__()
        # We inherit from pytorch geometric's GCN class, and we initialize three layers
        self.conv1 = GCNConv(data.num_features, hidden_channels)
        self.conv2 = GCNConv(hidden_channels, hidden_channels)
        self.conv3 = GCNConv(hidden_channels, hidden_channels)
        # Our final linear layer will define our output
        self.lin = Linear(hidden_channels, 8)
    def forward(self, x, edge_index, batch):
      # 1. Obtain node embeddings 
      x = self.conv1(x, edge_index)
      x = x.relu()
      x = self.conv2(x, edge_index)
      x = x.relu()
      x = self.conv3(x, edge_index)   
      # 2. Readout layer
      x = global_mean_pool(x, batch)  # [batch_size, hidden_channels]
      # 3. Apply a final classifier
      x = F.dropout(x, p=0.5,
      x = self.lin(x)
      return x
model = GCN(hidden_channels=64)

The error message seems clear?
That your model is needing more memory than the GPU memory size?

DefaultCPUAllocator is not the same as e.g. DefaultCUDAAllocator.