I am trying to create a custom loss function,
def loss(x,y):
    x_bb=x[:,:4]*224
    x_c=x[:,4:]
    y_bb=y[:,:4]*224
    y_c=y[:,4:]
    return F.l1_loss(x_bb.to(dtype=torch.long),y_bb.to(dtype=torch.long))+F.cross_entropy(x_c,y_c)*20

but it’s throwing me this error
RuntimeError: _thnn_l1_loss_forward not supported on CPUType for Long

I tried with different datatypes and with GPU as well, but got the same error, just instead of “CPUType” it’s showing the same error with “GPUType”