RuntimeEror: mat1 dim 1 must match mat2 dim 0

HELLO iam getting this error while i was running this code cell
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 =

    labels =

    # Forward pass

    outputs = model(images)

    loss = criterion(outputs, labels)

    # Backward and optimize




how to sove this

This error is most likely raised due to a tensor shape mismatch inside your model, e.g. in a linear layer. Print the activation shapes inside the forward method and make sure the feature size matches the expected in_features from the linear layers.