GRU4REC-pytorch
GRU4REC-pytorch copied to clipboard
Evaluation does not reset hidden states.
with torch.no_grad():
hidden = self.model.init_hidden()
for ii, (input, target, mask) in tqdm(enumerate(dataloader), total=len(dataloader.dataset.df) // dataloader.batch_size, miniters = 1000):
#for input, target, mask in dataloader:
input = input.to(self.device)
target = target.to(self.device)
logit, hidden = self.model(input, hidden)
logit_sampled = logit[:, target.view(-1)]
loss = self.loss_func(logit_sampled)
recall, mrr = lib.evaluate(logit, target, k=self.topk)
Hi, lib.evaluation.Evaluation does not reset hidden staes. Is that right?
@lyf-1 Sorry for my late reply, Yes, you are right, lib.evaluation.Evaluation does not reset hidden staes. I think that hidden state should be reseted before the input goes through the model. Thank you for your question!