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","."]
docstr: Extract values from a 1-D torch tensor for a batch of indices.
  
  Args:
      arr (torch.Tensor): the 1-D torch tensor.
      timesteps (torch.Tensor): a tensor of indices into the array to extract.
      broadcast_shape (torch.Size): a larger shape of K dimensions with the batch
                          dimension equal to the length of timesteps.
  Returns:
      torch.Tensor: a tensor of shape [batch_size, 1, ...] where the shape has K dims.
code: def _extract_into_tensor(self, arr, timesteps, broadcast_shape):
      r"""
      Extract values from a 1-D torch tensor for a batch of indices.
  
      Args:
          arr (torch.Tensor): the 1-D torch tensor.
          timesteps (torch.Tensor): a tensor of indices into the array to extract.
          broadcast_shape (torch.Size): a larger shape of K dimensions with the batch
                              dimension equal to the length of timesteps.
      Returns:
          torch.Tensor: a tensor of shape [batch_size, 1, ...] where the shape has K dims.
      """
      # res = torch.from_numpy(arr).to(device=timesteps.device)[timesteps].float()
      arr = arr.to(timesteps.device)
      res = arr[timesteps].float()
      while len(res.shape) < len(broadcast_shape):
          res = res[..., None]
      return res.expand(broadcast_shape)
  
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 17 for calling the DiffRec obj's underlying member method code with example usage: obj._extract_into_tensor(arr, timesteps, broadcast_shape) and returns: res