class_docstr: Random crop for item sequence.
class_docstr_tok: ["Random","crop","for","item","sequence","."]
code: def __call__(self, dataset, interaction):
      item_seq = interaction[self.ITEM_SEQ]
      item_seq_len = interaction[self.ITEM_SEQ_LEN]
      device = item_seq.device
      crop_item_seq_list, crop_item_seqlen_list = [], []
  
      for seq, length in zip(item_seq, item_seq_len):
          crop_len = math.floor(length * self.crop_eta)
          crop_begin = random.randint(0, length - crop_len)
          crop_item_seq = np.zeros(seq.shape[0])
          if crop_begin + crop_len < seq.shape[0]:
              crop_item_seq[:crop_len] = seq[
                  crop_begin : crop_begin + crop_len
              ]
          else:
              crop_item_seq[:crop_len] = seq[crop_begin:]
          crop_item_seq_list.append(
              torch.tensor(
                  crop_item_seq, dtype=torch.long, device=device
              )
          )
          crop_item_seqlen_list.append(
              torch.tensor(crop_len, dtype=torch.long, device=device)
          )
      new_dict = {
          self.CROP_ITEM_SEQ: torch.stack(crop_item_seq_list),
          self.CROP_ITEM_SEQ_LEN: torch.stack(crop_item_seqlen_list),
      }
      interaction.update(Interaction(new_dict))
      return interaction
  
imports: import math
  import numpy
  import random
  import torch
  from copy import deepcopy
  from recbole.data.interaction import Interaction, cat_interactions
label_desc: Use image node_id 2 for calling the CropItemSequence obj's underlying member method code with example usage: obj.__call__(dataset, interaction) and returns: interaction