Solved by ptrblck in post #2 
              
              
                The error message seems to point to the loss calculation. 
Could you check the shape of your model output and target and make sure the batch size is equal?