IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
target-> tensor([1., 0., 0., 1., 0., 1., 1., 0., 1., 1., 1., 1., 1., 0., 1., 1., 0., 0.,
0., 0., 1., 0., 0., 0., 1., 0.])
output-> tensor([-3.2691, -3.1722, -3.2648, -3.3598, -3.2569, -3.4140, -3.2098, -3.2161,
-3.4087, -3.2803, -3.1042, -3.1663, -3.3718, -3.3803, -3.1643, -3.2461,
-3.2690, -3.3987, -3.3615, -3.1216, -3.3198, -3.4017, -3.1110, -3.2741,
-3.1383, -3.1585], grad_fn=)
def train(epoch):
  model.train()
  for batch_idx, (data, target) in enumerate(train_loader):
    optimizer.zero_grad()
    output = model(data)
    print('target->',target[0])
    print('output->',output[0])
    criterion = nn.CrossEntropyLoss()
    loss = criterion(output[0],target[0])
    loss.backward()
    optimizer.step()
    if batch_idx % log_interval == 0:
      print('Train Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}'.format(
        epoch, batch_idx * len(data), len(train_loader.dataset),
        100. * batch_idx / len(train_loader), loss.item()))
      train_losses.append(loss.item())
      train_counter.append(
        (batch_idx*64) + ((epoch-1)*len(train_loader.dataset)))
      torch.save(model.state_dict(), './result/model.pth')
      torch.save(optimizer.state_dict(), './result/optimizer.pth')