Hello everyone
I am trying to train my 1d conv autoencoder. In part of training the NN,I faced with the below error:
//////////////////////////////////////////////////////////////////////////////////////////////////
“Using a target size (torch.Size([2048, 1, 94])) that is different to the input size (torch.Size([2048, 1, 93])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.
return F.mse_loss(input, target, reduction=self.reduction)”
//////////////////////////////////////////////////////////////////////////////////
I am quite sure that my input tensor has the right size. because just before running the training loop, when ever I checked the size of that it gave me the right answer.
My input size is (2040,1,94) which 2040 is batch number in every singel training, 1 is the input channel size and 94 is length of my signal.
below is my training codes:
#training loop
for epoch in range(num_epochs):
for data in dataloader:
img = data
# ===================forward=====================
output = model(img)
loss = criterion(output, img)
# ===================backward====================
optimizer.zero_grad()
loss.backward()
optimizer.step()