code: def compute_values_for_mdps(
      rewards: torch.Tensor,
      mdp_ids: torch.Tensor,
      sequence_numbers: torch.Tensor,
      gamma: float,
  ) -> torch.Tensor:
      values = rewards.clone()
  
      for x in range(len(values) - 2, -1, -1):
          if mdp_ids[x] != mdp_ids[x + 1]:
              # Value = reward for new mdp_id
              continue
          values[x, 0] += values[x + 1, 0] * math.pow(
              gamma,
              float(
                  sequence_numbers[x + 1, 0] - sequence_numbers[x, 0]
              ),
          )
  
      return values
  
imports: from __future__ import annotations
  import logging
  import math
  from dataclasses import dataclass, fields
  from typing import cast, Optional, TYPE_CHECKING
  import numpy
  import torch
  import torch.nn
  from reagent.core import types
  from reagent.core.torch_utils import masked_softmax
  from reagent.model_utils.seq2slate_utils import Seq2SlateMode
  from reagent.models.seq2slate import Seq2SlateTransformerNet
label_desc: Use image node_id 8 for calling the EvaluationDataPage obj's underlying member method code with example usage: obj.compute_values_for_mdps(rewards, mdp_ids, sequence_numbers, gamma) and returns: values