Hi Alban,
thanks for your email,
I see your point but I guess we can simply calculate the gradient of  any tensor right? does not need to be involved directly in calculating the loss right?
Trying to check this point further, I tried to see the (.grad) of the tensors (data_phrases) and (data_words) and found that the gradients of the tensor (data_phrases) are updated unlike those of the tensor (data_words) it is always = None.
But coming to these 2 lines:
self.optimizer.add_param_group({“params”: data_phrases})
self.optimizer.add_param_group({“params”: data_words})
I guess the matter is related to a problem in passing the tensor (data_words) to the optimizer.  For some reason only the (tensor_phrases) is passed correctly to the optimizer, but not the tensor (data_words). to check further, instead of trying to pass the tensors (data_phrases & data_words) one after one, I only passed one tensor (data_words) alone, and in this case it worked well and I saw gradients were calculated.
So my question turns to be: How can I pass multiple tensors together to the optimizer? I tried many times but it does not work.
Any advise?
Thanks
A