Hi @my3bikaht , thank you for your response.
While running the training loop (code mentioned above), I get the error that AttributeError: 'MSE_ITL_RegLoss' object has no attribute 'backward'
This is the error traceback:
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-13-fc852af04b41> in <module>
     15 
     16         optimizer.zero_grad()
---> 17         loss.backward()
     18         optimizer.step()
     19 

c:\...\torch\nn\modules\module.py in __getattr__(self, name)
   1176                 return modules[name]
   1177         raise AttributeError("'{}' object has no attribute '{}'".format(
-> 1178             type(self).__name__, name))
   1179 
   1180     def __setattr__(self, name: str, value: Union[Tensor, 'Module']) -> None:

AttributeError: 'MSE_ITL_RegLoss' object has no attribute 'backward'

Is there anything that can be done?