model = Unet(in_channels =1, out_channels =1)
criterion = nn.BCEWithLogitsLoss()                                                           # Loss and optimizer
optimizer = torch.optim.SGD(model.parameters(), lr=learning_rate,momentum=0.9)

for epoch in tqdm_notebook(range(num_epochs)):
         
#         print(epoch)
        total_train = 0
        correct_train = 0
        epoch_loss = 0
        DICE = 0
      
        for k,train_img in enumerate(trainLoader):
            
            inputs,labels = train_img
#             print(inputs.shape)
            inputs = inputs.unsqueeze_(0)
            inputs = inputs.reshape(batch_size_train,1,img_width,img_height)
            labels = labels.unsqueeze_(0)
            labels = labels.reshape(batch_size_train,1,img_width,img_height)

            # Forward pass 
            optimizer.zero_grad()                                                 # zeroes the gradient buffers of all parameters
            outputs = model(inputs)                                               # outputs.shape =(batch_size, n_classes, img_cols, img_rows)

            outputs = outputs.permute(0, 2, 3, 1)                                 # outputs.shape =(batch_size, img_cols, img_rows, n_classes)

            m = outputs.shape[0]                                                  # m = batch size
            width_out  = outputs.shape[2] 
            height_out = outputs.shape[1] 
            outputs_new = outputs.resize(m*width_out*height_out)                   # Resizing the outputs and label to calculate pixel wise softmax loss
            labels_new = labels.resize(m*width_out*height_out)         
            loss = criterion(outputs_new,labels_new)       
            epoch_loss += loss.item()
         
            loss.backward()                                                      # Backward and optimizeuns
            optimizer.step()                                                     # update gradients
            print(k,'done')    
            
            DICE += dice_coeff(outputs[0,:,:,0], labels[0,0,:,:]).item()
            print(DICE)
            
            _, predicted = torch.max(outputs_new.data, 1)
            print(predicted.shape)
            total_train += labels_new.nelement()                                    
            correct_train += predicted.eq(labels_new.data).sum().item()
            train_accuracy = 100 * correct_train / total_train```
type or paste code here

c**an someone explain what does this line do  _, predicted = torch.max(outputs_new.data, 1)**

I am getting an error as IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

my predicted binary segmented output is 540*800