Hi,
My convLSTM model returns a list of hidden states and my target is a list of 17 images( all  tensors)
When the loss function is called, I get the following error:

File “/Users/xyz/opt/anaconda3/envs/matrix/lib/python3.7/site->packages/torch/nn/modules/loss.py”, line 498, in forward
return F.binary_cross_entropy(input, target, weight=self.weight, >reduction=self.reduction)
File “/Users/xyz/opt/anaconda3/envs/matrix/lib/python3.7/site->packages/torch/nn/functional.py”, line 2052, in binary_cross_entropy
if target.size() != input.size():
AttributeError: ‘list’ object has no attribute ‘size’

Part of the training loop:
hc = model.init_hidden(batch_size=1)
for batch_idx, (data, target) in enumerate(train_loader):
    optimizer.zero_grad()
    # Set target, images 2 to 18
    target = data[1:]
    if gpu:
        data = data.cuda()
        target = target.cuda()
        hc.cuda()
    # Get outputs of LSTM
    output = model(data, hc)
    # Calculate loss
    loss = criterion(output, target)
    loss.backward()
    optimizer.step()

How can I fix this?