Do you know why this fix for format didn’t work for all tensors?
        if batch_idx % args.log_interval == 0:
            print('Train Epoch: {} [{}/{}]\t'
                  'Loss: {:.4f} ({:.4f}) \t'
                  'Acc: {:.2f}% ({:.2f}%) \t'
                  'Emb_Norm: {:.2f} ({:.2f})'.format(
                epoch, batch_idx * num_items, len(train_loader.dataset),
                losses.val.item(), losses.avg.item(), 
                100. * accs.val.item(), 100. * accs.avg.item(), emb_norms.val.item(), emb_norms.avg.item()))

error is

File “main.py”, line 167, in main     train(train_loader, tnet, criterion, optimizer, epoch)   File “main.py”, line 251, in train     losses.val.item(), losses.avg.item(),  AttributeError: ‘float’ object has no attribute ‘item’