below is my code and the image shows the error which iam getting please ty to help
3x3 convolution
class CNN(nn.Module):
“”“CNN.”""
def __init__(self):
    """CNN Builder."""
    super(CNN, self).__init__()

    self.conv_layer = nn.Sequential(
    

        # Conv Layer block 1
        nn.Conv2d(in_channels=3, out_channels=15, kernel_size=3, padding=1),
        nn.BatchNorm2d(15),
        nn.ReLU(inplace=True),
        nn.Conv2d(in_channels=15, out_channels=64, kernel_size=3, padding=1),
        nn.ReLU(inplace=True),
        nn.MaxPool2d(kernel_size=2, stride=2),

        # Conv Layer block 2
        nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1),
        nn.BatchNorm2d(128),
        nn.ReLU(inplace=True),
        nn.Conv2d(in_channels=128, out_channels=128, kernel_size=3, padding=1),
        nn.ReLU(inplace=True),
        nn.MaxPool2d(kernel_size=2, stride=2),
        nn.Dropout2d(p=0.05),

        # Conv Layer block 3
        nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=1),
        nn.BatchNorm2d(256),
        nn.ReLU(inplace=True),
        nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, padding=1),
        nn.ReLU(inplace=True),
        nn.MaxPool2d(kernel_size=2, stride=2),
    )


    self.fc_layer = nn.Sequential(
        nn.Dropout(p=0.1),
        nn.Linear(4096, 1024),
        nn.ReLU(inplace=True),
        nn.Linear(1024, 512),
        nn.ReLU(inplace=True),
        nn.Dropout(p=0.1),
        nn.Linear(512, 10)
    )


def forward(self, X):
    """Perform forward."""
    
    # conv layers
    X = self.conv_layer(X)
    
    # flatten
    X = X.view(X.size(0), -1)
    # fc layer
    X = self.fc_layer(X)

    return X

print(X)
from keras.optimizers import Adam
model = CNN().to(device)
defining the optimizer
optimizer = Adam(model.parameters(), lr=0.07)
defining the loss function
criterion = nn.CrossEntropyLoss()
checking if GPU is available
if torch.cuda.is_available():
model = model.cuda()
criterion = criterion.cuda()
print(model)
model = CNN().to(device)
Loss and optimizer
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)
For updating learning rate
def update_lr(optimizer, lr):
for param_group in optimizer.param_groups:
param_group[‘lr’] = lr
Train the model
total_step = len(train_loader)
curr_lr = learning_rate
for epoch in range(num_epochs):
for i, (images, labels) in enumerate(train_loader):
images = images.to(device)
labels = labels.to(device)
    # Forward pass
    outputs = model(images)
    loss = criterion(outputs, labels)

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

    if (i+1) % 500 == 0:
        print ("Epoch [{}/{}], Step [{}/{}] Loss: {:.4f}"
               .format(epoch+1, num_epochs, i+1, total_step, loss.item()))

# Decay learning rate
if (epoch) == 1 or epoch>20:
    curr_lr /= 3
    update_lr(optimizer, curr_lr)
    
    # Test the model
    model.eval()
    with torch.no_grad():
        correct = 0
        total = 0
        for images, labels in test_loader:
            images = images.to(device)
            labels = labels.to(device)
            outputs = model(images)
            _, predicted = torch.max(outputs.data, 1)
            total += labels.size(0)
            correct += (predicted == labels).sum().item()
    
        print('Accuracy of the model on the test images: {} %'.format(100 * correct / total))
            
    model.train()

image1178×518 46.4 KB