Hi all together,
I have problems with using the nn.MSELoss method for image classification: RuntimeError: bool value of Tensor with more than one value is ambiguous. Size of image and label are both (8, 104) - Do you have any ideas what the problem could be?
model = EasyNet()
optimizer = optim.SGD(model.parameters(), lr=0.001, momentum=0.5)
def train(epoch):
# Training
model.train()
for image, label in train_loader:
# Transfer to GPU
# image, label = image.to(device), label.to(device)
if image is None:
continue
    # Forward
    image = Variable(image)
    label = Variable(label)
    pred = model(image)
    print(pred.size())
    print(label.size())
    # print(pred)

optimizer.zero_grad()
loss = nn.MSELoss(pred, label)
    # Backward
    loss.backward()
    optimizer.step()
    global train_iter