Solved by wadewang in post #2 
              
              
                I make it by myself inspired by this comment 
import torch
import torch.nn.functional as F

pred = torch.Tensor([[-4.5665, -4.6113, -4.6146, -4.5443, -4.6290, -4.5983],
        [-4.5546, -4.5603, -4.5680, -4.6010, -4.6175, -4.6058],
        [-4.5971, -4.5846, -4.5514, -4.5913, -4.6732, -4.5830],
   …