In my encoder decoder model ,output of encoder when goes to decoder it gives this error.
Code is-
torch.set_default_tensor_type('torch.cuda.FloatTensor')
model=GRUNet()

n_epochs = 50
model=model.cuda()
valid_loss_min = np.Inf # track change in validation loss
model.train()
train_loss = 0.0

for epoch in range(1, n_epochs+1):
    print("ALL ABOUT LOSS--------",(train_loss/len(images)),"----------/n")
    train_loss = 0.0                
    for i in range(len(im)):

          data=im[i].cuda()
          tar=targ[i].cuda()
          
            
          optimizer.zero_grad()
            # forward pass: compute predicted outputs by passing inputs to the model
          
          loss = criterion(model(data), tar)
            
          loss.backward()
            optimizer.step()
            # update training loss
          train_loss += loss.item()*data.size(0)