Hi Subho,
have a look at the Extending PyTorch docs 4.
From these docs:

It should return as many Tensor s as there were inputs, with each of them containing the gradient w.r.t. its corresponding input. If your inputs didn’t require gradient ( needs_input_grad is a tuple of booleans indicating whether each input needs gradient computation), or were non- Tensor objects, you can return None .

As it seems you are working on some kind of lecture assignment, you shouldn’t expect to get a complete solution.
Also, I’m not a big fan of posting repeatedly and would l like to ask you to be a bit more patient