fix my code, it running on colab and on cpu so i do not want any recommendations to change it to a gpu
code
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms, datasets

# Define device as CPU
device = torch.device('cpu')
print(f'Using {device} device')

# Define your dataset class
class HandSignsDataset(Dataset):
    def __init__(self, root_dir, transform=None):
        self.transform = transform
        self.images = datasets.ImageFolder(root=root_dir, transform=transform)
        self.classes = self.images.classes
        self.num_classes = len(self.classes)

    def __len__(self):
        return len(self.images)

    def __getitem__(self, idx):
        if torch.is_tensor(idx):
            idx = idx.tolist()
        img, label = self.images[idx]
        return img, label

# Define transformation pipeline
transform = transforms.Compose([
    transforms.Resize((64, 64)),  # Resize images to a smaller resolution
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])

# Specify your paths here
train_data_path = '/content/drive/MyDrive/Output_ISL/train'
test_data_path = '/content/drive/MyDrive/Output_ISL/test'

# Loading the datasets
# Loading the datasets
train_dataset = HandSignsDataset(root_dir=train_data_path, transform=transform)
test_dataset = HandSignsDataset(root_dir=test_data_path, transform=transform)

# Specify batch_size for DataLoader
batch_size = 64

train_loader = DataLoader(train_dataset, batch_size=batch_size, shuffle=True)
test_loader = DataLoader(test_dataset, batch_size=batch_size, shuffle=False)

# Determine the number of classes dynamically
num_classes = train_dataset.num_classes

# Define a simple Neural Network
class Net(nn.Module):
    def __init__(self, num_classes):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(3, 8, kernel_size=3, stride=1, padding=1)
        self.pool = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)
        # Adjust the input size calculation to account for max pooling
        self.fc1 = nn.Linear(8 * 16 * 16 // 4, 64)  # Divide by 4 to account for max pooling (2x2)
        self.fc2 = nn.Linear(64, num_classes)

    def forward(self, x):
        x = self.pool(nn.functional.relu(self.conv1(x)))
        # Update the view size to match the adjusted input size
        x = x.view(-1, 8 * 16 * 16 // 4)
        x = nn.functional.relu(self.fc1(x))
        x = self.fc2(x)
        return x

# Instantiate the model
model = Net(num_classes).to(device)

# Loss and optimizer
criterion = nn.CrossEntropyLoss()
optimizer = optim.Adam(model.parameters(), lr=0.001)

# Training the model
def train_model(model, criterion, optimizer, train_loader, num_epochs=10):
    model.train()
    for epoch in range(num_epochs):
        running_loss = 0.0
        for i, (images, labels) in enumerate(train_loader):
            images, labels = images.to(device), labels.to(device)

            # Forward pass
            outputs = model(images)
            loss = criterion(outputs, labels)

            # Backward and optimize
            optimizer.zero_grad()
            loss.backward()
            optimizer.step()

            running_loss += loss.item()

            # Print statistics every 100 mini-batches
            if i % 100 == 99:
                print(f'Epoch [{epoch+1}/{num_epochs}], Batch [{i+1}/{len(train_loader)}], Loss: {running_loss / 100:.4f}')
                running_loss = 0.0

# Function to test the model
def test_model(model, test_loader):
    model.eval()
    correct = 0
    total = 0
    with torch.no_grad():
        for images, labels in test_loader:
            images, labels = images.to(device), labels.to(device)
            outputs = model(images)
            _, predicted = torch.max(outputs.data, 1)
            total += labels.size(0)
            correct += (predicted == labels).sum().item()

    print(f'Accuracy of the model on the test images: {100 * correct / total:.2f}%')

# Train the model
train_model(model, criterion, optimizer, train_loader)

# Test the model
test_model(model, test_loader)