def corr_basic_calc(weights, y_pred):
    num_classes = len(weights[:,0])
    m_c = []
    sum_m_c = []
    for i in range(num_classes):
        m_c.append(y_pred[:,i])
        sum_m_c.append(torch.sum(m_c[i]))

    return num_classes, torch.tensor(m_c,dtype=torch.long), torch.tensor(sum_m_c,dtype=torch.long)

check out this 1.

torch. tensor (data, *, dtype=None, device=None, requires_grad=False, pin_memory=False ) → Tensor
Constructs a tensor with data.
Parameters
data (array_like) – Initial data for the tensor. Can be a list, tuple, NumPy ndarray, scalar, and other types.

you’re using list of tensors as data. it’s incompatible
maybe you can use torch.stack or torch.cat instead.