code: def _single_action_to_triplet(
      action_val: int,
      basis: int,
      out_dim: int,
      bias: int,
      device: str,
  ):
      """Converts an action to the original triplet (u, v, w) that generated it.
  
      Args:
          action_val (int): Action to convert.
          basis (int): Basis used for the conversion.
          out_dim (int): Output dimension.
          bias (int): Bias to subtract from the action.
          device (str): Name of the torch device to use.
      """
      triplet = torch.zeros(out_dim).to(device)
      if action_val > 0:
          idx = int(
              torch.log(torch.tensor(action_val))
              // torch.log(torch.tensor(basis))
          )
      else:
          idx = 0
      while idx >= 0:
          temp = int(basis**idx)
          triplet[idx] = action_val // temp - bias
          action_val = action_val - temp
          idx -= 1
      return triplet
  
imports: from typing import Tuple
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: _single_action_to_triplet(action_val, basis, out_dim, bias, device) and returns: triplet