code: def _flat_idx_to_idx(
      flat_idx: int,
      dims: Tuple[int],
  ) -> Tuple[int]:
      idx = []
      for d in reversed(dims):
          idx.append(flat_idx % d)
          flat_idx = flat_idx // d
  
      return tuple(reversed(idx))
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/esm/openfold_utils/chunk_utils.py
imports: import logging
  import math
  from functools import partial
  from typing import Any, Callable, Dict, Optional, Sequence, Tuple
  import torch
  from .tensor_utils import tensor_tree_map, tree_map
label_desc: Use image node_id 2 for calling a global function with example usage: _flat_idx_to_idx(flat_idx, dims) and returns: tuple