code: def optimizer_type_to_emb_opt_type(
      optimizer_class: Type[torch.optim.Optimizer],
  ) -> Optional[EmbOptimType]:
      # TODO add more optimizers to be in parity with ones provided by FBGEMM
      # TODO kwargs accepted by fbgemm and and canonical optimizers are different
      # may need to add special handling for them
      lookup = {
          torch.optim.SGD: EmbOptimType.EXACT_SGD,
          torch.optim.Adagrad: EmbOptimType.EXACT_ADAGRAD,
          torch.optim.Adam: EmbOptimType.ADAM,
          # below are torchrec wrappers over these optims.
          # they accept an **unused kwargs portion, that let us set FBGEMM specific args such as
          # max gradient, etc
          trec_optim.SGD: EmbOptimType.EXACT_SGD,
          trec_optim.LarsSGD: EmbOptimType.LARS_SGD,
          trec_optim.LAMB: EmbOptimType.LAMB,
          trec_optim.PartialRowWiseLAMB: EmbOptimType.PARTIAL_ROWWISE_LAMB,
          trec_optim.Adam: EmbOptimType.ADAM,
          trec_optim.PartialRowWiseAdam: EmbOptimType.PARTIAL_ROWWISE_ADAM,
          trec_optim.Adagrad: EmbOptimType.EXACT_ADAGRAD,
          trec_optim.RowWiseAdagrad: EmbOptimType.EXACT_ROWWISE_ADAGRAD,
      }
      if optimizer_class not in lookup:
          raise ValueError(
              f"Cannot cast {optimizer_class} to an EmbOptimType"
          )
      return lookup[optimizer_class]
  
imports: import copy
  import logging
  from collections import OrderedDict
  from itertools import accumulate
  from typing import Any, Dict, List, Optional, Set, Type, TypeVar, Union
  import torch
  from fbgemm_gpu.split_embedding_configs import EmbOptimType
  from torch import nn
  from torchrec import optim
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel
  from torchrec.distributed.types import DataType, ParameterSharding, ShardedModule, ShardingType
  from torchrec.modules.embedding_configs import data_type_to_sparse_type
  from torchrec.types import CopyMixIn
label_desc: Use image node_id 8 for calling a global function with example usage: optimizer_type_to_emb_opt_type(optimizer_class) and returns: lookup