@ptrblck
class loss(torch.nn.Module):
    def __init__(self):
        super(qloss, self).__init__()
        self.w=torch.nn.Parameter( torch.tensor([0.2,0.5,0.8]))

I have defined loss as Module and put some learnable paramters their  as you see above.
Will these parameters be updated ,optimizers i suppose takes care of updating only model .parameters