code: def pooling_type_to_pooling_mode(
      pooling_type: PoolingType,
  ) -> PoolingMode:
      if pooling_type.value == PoolingType.SUM.value:
          return PoolingMode.SUM
      elif pooling_type.value == PoolingType.MEAN.value:
          return PoolingMode.MEAN
      elif pooling_type.value == PoolingType.NONE.value:
          return PoolingMode.NONE
      else:
          raise Exception(f"Invalid pooling type {pooling_type}")
  
imports: from dataclasses import dataclass, field
  from enum import Enum, unique
  from functools import partial
  from math import sqrt
  from typing import Callable, Dict, List, NamedTuple, Optional
  import torch
  from fbgemm_gpu.split_embedding_configs import SparseType
  from fbgemm_gpu.split_table_batched_embeddings_ops_training import PoolingMode
  from torchrec.types import DataType
label_desc: Use image node_id 2 for calling a global function with example usage: pooling_type_to_pooling_mode(pooling_type) and returns: PoolingMode, PoolingMode, PoolingMode