code: def transfer_weights_torch_to_tf(tf_vars, var_map_dict, state_dict):
      """Transfer weigths from torch state_dict to TF variables"""
      print(" > Passing weights from Torch to TF ...")
      for tf_var in tf_vars:
          torch_var_name = var_map_dict[tf_var.name]
          print(f" | > {tf_var.name} <-- {torch_var_name}")
          # if tuple, it is a bias variable
          if "kernel" in tf_var.name:
              torch_weight = state_dict[torch_var_name]
              numpy_weight = torch_weight.permute([2, 1, 0]).numpy()[
                  :, None, :, :
              ]
          if "bias" in tf_var.name:
              torch_weight = state_dict[torch_var_name]
              numpy_weight = torch_weight
          assert np.all(
              tf_var.shape == numpy_weight.shape
          ), f" [!] weight shapes does not match: {tf_var.name} vs {torch_var_name} --> {tf_var.shape} vs {numpy_weight.shape}"
          tf.keras.backend.set_value(tf_var, numpy_weight)
      return tf_vars
  
imports: import numpy
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: transfer_weights_torch_to_tf(tf_vars, var_map_dict, state_dict) and returns: tf_vars