Stack Exchange
The size of tensor a (197) must match the size of tensor b (577) at non-singleton dimension 1
cpu
1 1 384 384 16
24 24
Early Stopper :  False
Epoch 1/25
torch.Size([8, 197, 768])
model_ft =  VisionTransformer.from_name('R50+ViT-B_16', num_classes=4)
model_ft = model_ft.to(device)
criterion = nn.CrossEntropyLoss()
        
# Observe that all parameters are being optimized
optimizer_ft = optim.SGD(model_ft.parameters(), lr=0.001, momentum=0.9)
                                                           
# Decay LR by a factor of 0.1 every 7 epochs
exp_lr_scheduler = lr_scheduler.StepLR(optimizer_ft, step_size=7, gamma=0.1)
cudnn.benchmark = True
model_trained = train_model(model_ft, criterion, optimizer_ft, exp_lr_scheduler, num_epochs=25)

print(model_ft)

i want to train R50+ViT-B_16
