code: def compute_reward(ranked_cities):
      assert len(ranked_cities.shape) == 3
      ranked_cities_offset = torch.roll(ranked_cities, shifts=1, dims=1)
      return (
          torch.sqrt(
              ((ranked_cities_offset - ranked_cities) ** 2).sum(-1)
          )
          .sum(-1)
          .unsqueeze(1)
      )
  
imports: import logging
  import math
  import tempfile
  from itertools import permutations
  import pytorch_lightning
  import reagent.core.types
  import torch
  import torch.nn
  from reagent.core.parameters import Seq2SlateParameters
  from reagent.core.parameters_seq2slate import LearningMethod, SimulationParameters
  from reagent.core.torch_utils import gather
  from reagent.model_utils.seq2slate_utils import Seq2SlateOutputArch
  from reagent.models.seq2slate import Seq2SlateMode, Seq2SlateTransformerNet
  from reagent.optimizer.union import Optimizer__Union
  from reagent.training.ranking.seq2slate_sim_trainer import Seq2SlateSimulationTrainer
  from reagent.training.ranking.seq2slate_trainer import Seq2SlateTrainer
  from torch.utils.data import DataLoader
label_desc: Use image node_id 6 for calling a global function with example usage: compute_reward(ranked_cities) and returns: torch