code: def reorder_inverse_indices(
      inverse_indices: Optional[Tuple[List[str], torch.Tensor]],
      feature_names: List[str],
  ) -> torch.Tensor:
      if inverse_indices is None:
          return torch.empty(0)
      index_per_name = {
          name: i for i, name in enumerate(inverse_indices[0])
      }
      index = torch.tensor(
          [
              index_per_name[name.split("@")[0]]
              for name in feature_names
          ],
          device=inverse_indices[1].device,
      )
      return torch.index_select(inverse_indices[1], 0, index)
  
imports: import abc
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  import torch.nn
  from torchrec.modules.embedding_configs import DataType, EmbeddingBagConfig, EmbeddingConfig, pooling_type_to_str
  from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor, KeyedTensor
label_desc: Use image node_id 1 for calling a global function with example usage: reorder_inverse_indices(inverse_indices, feature_names) and returns: torch, torch