Hi,
I wanted to add 2 data tensors to the optimizer (data_words & data_phrases) but only (data_phrases) is optimized and not (data_words). Is there any mistake in the way I added them to the optimizer as in the sample code below (from inside the training loop of a softmax model)?

self.optimizer.zero_grad()
data_phrases = Variable(sample[0][0], requires_grad=True)
data_words = Variable(sample[1][0], requires_grad=True)
self.data_phrases  = nn.Parameter(data_phrases)
self.data_words = nn.Parameter(data_words)
self.optimizer.add_param_group({“params”: data_phrases})
self.optimizer.add_param_group({“params”: data_words})
labels_phrases = sample[0][1].type(torch.LongTensor)-1
logits, probas = self.model(data_phrases .float())
loss = self.criterion(logits, labels_phrases) + self.regularizer
loss.backward(retain_graph=True)
self.optimizer.step()

Best