class_docstr: L-DiffRec clusters items into groups, compresses the interaction vector over each group into a
  low-dimensional latent vector via a group-specific VAE, and conducts the forward and reverse
  diffusion processes in the latent space.
class_docstr_tok: ["L-DiffRec","clusters","items","into","groups",",","compresses","the","interaction","vector","over","each","group","into","a","low-dimensional","latent","vector","via","a","group-specific","VAE",",","and","conducts","the","forward","and","reverse","diffusion","processes","in","the","latent","space","."]
code: def __init__(self, config, dataset):
      super(LDiffRec, self).__init__(config, dataset)
      self.n_cate = config["n_cate"]
      self.reparam = config["reparam"]
      self.ae_act_func = config["ae_act_func"]
      self.in_dims = config["in_dims"]
      self.out_dims = config["out_dims"]
  
      # control loss in training
      self.update_count = 0
      self.update_count_vae = 0
      self.lamda = config["lamda"]
      self.anneal_cap = config["anneal_cap"]
      self.anneal_steps = config["anneal_steps"]
      self.vae_anneal_cap = config["vae_anneal_cap"]
      self.vae_anneal_steps = config["vae_anneal_steps"]
  
      out_dims = self.out_dims
      in_dims = self.in_dims[::-1]
      emb_path = os.path.join(dataset.dataset_path, f"item_emb.npy")
      if self.n_cate > 1:
          if not os.path.exists(emb_path):
              self.logger.exception(
                  "The item embedding file must be given when n_cate>1."
              )
          item_emb = torch.from_numpy(
              np.load(emb_path, allow_pickle=True)
          )
      else:
          item_emb = torch.zeros((self.n_items - 1, 64))
      self.autoencoder = AutoEncoder(
          item_emb,
          self.n_cate,
          in_dims,
          out_dims,
          self.device,
          self.ae_act_func,
          self.reparam,
      ).to(self.device)
  
      self.latent_size = in_dims[-1]
      dims = (
          [self.latent_size] + config["dims_dnn"] + [self.latent_size]
      )
      self.mlp = DNN(
          dims=dims,
          emb_size=self.emb_size,
          time_type="cat",
          norm=self.norm,
          act_func=self.mlp_act_func,
      ).to(self.device)
  
imports: import os
  import numpy
  import torch
  import torch.nn.functional
  import torch.nn
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.layers import MLPLayers
  from recbole.model.general_recommender.diffrec import DiffRec, DNN, ModelMeanType, mean_flat
label_desc: Use image node_id 1 to create a new LDiffRec object from inherited base classes: DiffRec with example: obj = LDiffRec(config, dataset)