Sir, I have edited the post…
I have specified my custom loss function, which takes two sets of datasets (and 2 sets of class labels) as input.
When i call  backward() function on this loss , I am getting no output. When traced with intermediate values. I am getting NaNs