class_docstr: DiffRec is a generative recommender model which infers users' interaction probabilities in a denoising manner.
  Note that DiffRec simultaneously ranks all items for each user.
  We implement the the DiffRec model with only user dataloader.
class_docstr_tok: ["DiffRec","is","a","generative","recommender","model","which","infers","users","'","interaction","probabilities","in","a","denoising","manner",".","Note","that","DiffRec","simultaneously","ranks","all","items","for","each","user",".","We","implement","the","the","DiffRec","model","with","only","user","dataloader","."]
code: def update_Lt_history(self, ts, reloss):
      # update Lt_history & Lt_count
      for t, loss in zip(ts, reloss):
          if self.Lt_count[t] == self.history_num_per_term:
              Lt_history_old = self.Lt_history.clone()
              self.Lt_history[t, :-1] = Lt_history_old[t, 1:]
              self.Lt_history[t, -1] = loss.detach()
          else:
              try:
                  self.Lt_history[t, self.Lt_count[t]] = loss.detach()
                  self.Lt_count[t] += 1
              except:
                  print(t)
                  print(self.Lt_count[t])
                  print(loss)
                  raise ValueError
  
imports: import enum
  import math
  import copy
  import numpy
  import torch
  import torch.nn.functional
  import torch.nn
  from recbole.model.init import xavier_normal_initialization
  from recbole.utils.enum_type import InputType
  from recbole.model.abstract_recommender import AutoEncoderMixin, GeneralRecommender
  from recbole.model.layers import MLPLayers
  import typing
label_desc: Use image node_id 10 for calling the DiffRec obj's underlying member method code with example usage: obj.update_Lt_history(ts, reloss) without return types