code: def convert_tf_weight_name_to_pt_weight_name(
      tf_name, start_prefix_to_remove="", tf_weight_shape=None
  ):
      """
      Convert a TF 2.0 model variable name in a pytorch model weight name.
  
      Conventions for TF2.0 scopes -> PyTorch attribute names conversions:
  
          - '$1___$2' is replaced by $2 (can be used to duplicate or remove layers in TF2.0 vs PyTorch)
          - '_._' is replaced by a new level separation (can be used to convert TF2.0 lists in PyTorch nn.ModulesList)
  
      return tuple with:
  
          - pytorch model weight name
          - transpose: `TransposeType` member indicating whether and how TF2.0 and PyTorch weights matrices should be
            transposed with regards to each other
      """
      tf_name = tf_name.replace(":0", "")  # device ids
      tf_name = re.sub(
          r"/[^/]*___([^/]*)/", r"/\1/", tf_name
      )  # '$1___$2' is replaced by $2 (can be used to duplicate or remove layers in TF2.0 vs PyTorch)
      tf_name = tf_name.replace(
          "_._", "/"
      )  # '_._' is replaced by a level separation (can be used to convert TF2.0 lists in PyTorch nn.ModulesList)
      tf_name = re.sub(
          r"//+", "/", tf_name
      )  # Remove empty levels at the end
      tf_name = tf_name.split(
          "/"
      )  # Convert from TF2.0 '/' separators to PyTorch '.' separators
      # Some weights have a single name without "/" such as final_logits_bias in BART
      if len(tf_name) > 1:
          tf_name = tf_name[1:]  # Remove level zero
  
      tf_weight_shape = list(tf_weight_shape)
  
      # When should we transpose the weights
      if (
          tf_name[-1] == "kernel"
          and tf_weight_shape is not None
          and len(tf_weight_shape) == 4
      ):
          transpose = TransposeType.CONV2D
      elif (
          tf_name[-1] == "kernel"
          and tf_weight_shape is not None
          and len(tf_weight_shape) == 3
      ):
          transpose = TransposeType.CONV1D
      elif bool(
          tf_name[-1]
          in ["kernel", "pointwise_kernel", "depthwise_kernel"]
          or "emb_projs" in tf_name
          or "out_projs" in tf_name
      ):
          transpose = TransposeType.SIMPLE
      else:
          transpose = TransposeType.NO
  
      # Convert standard TF2.0 names in PyTorch names
      if (
          tf_name[-1] == "kernel"
          or tf_name[-1] == "embeddings"
          or tf_name[-1] == "gamma"
      ):
          tf_name[-1] = "weight"
      if tf_name[-1] == "beta":
          tf_name[-1] = "bias"
  
      # The SeparableConv1D TF layer contains two weights that are translated to PyTorch Conv1D here
      if (
          tf_name[-1] == "pointwise_kernel"
          or tf_name[-1] == "depthwise_kernel"
      ):
          tf_name[-1] = tf_name[-1].replace("_kernel", ".weight")
  
      # Remove prefix if needed
      tf_name = ".".join(tf_name)
      if start_prefix_to_remove:
          tf_name = tf_name.replace(start_prefix_to_remove, "", 1)
  
      return tf_name, transpose
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/modeling_tf_pytorch_utils.py
imports: import os
  import re
  import numpy
  from .utils import ExplicitEnum, expand_dims, is_numpy_array, is_torch_tensor, logging, reshape, squeeze, tensor_size
  from .utils import transpose
label_desc: Use image node_id 1 for calling a global function with example usage: convert_tf_weight_name_to_pt_weight_name(tf_name, start_prefix_to_remove, tf_weight_shape) and returns: tf_name,  transpose