class_docstr: Reorder operation for item sequence.
class_docstr_tok: ["Reorder","operation","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
      reorder_seq_list = []
  
      for seq, length in zip(item_seq, item_seq_len):
          reorder_len = math.floor(length * self.reorder_beta)
          reorder_begin = random.randint(0, length - reorder_len)
          reorder_item_seq = seq.cpu().detach().numpy().copy()
  
          shuffle_index = list(
              range(reorder_begin, reorder_begin + reorder_len)
          )
          random.shuffle(shuffle_index)
          reorder_item_seq[
              reorder_begin : reorder_begin + reorder_len
          ] = reorder_item_seq[shuffle_index]
  
          reorder_seq_list.append(
              torch.tensor(
                  reorder_item_seq, dtype=torch.long, device=device
              )
          )
      new_dict = {self.REORDER_ITEM_SEQ: torch.stack(reorder_seq_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 ReorderItemSequence obj's underlying member method code with example usage: obj.__call__(dataset, interaction) and returns: interaction