code: def _rename_weights_for_alexnet(weights, weights_type, model_name):
      original_keys = sorted(weights.keys())
      layer_keys = sorted(weights.keys())
  
      # performs basic renaming: _ -> . , etc
      if weights_type == "caffe2":
          layer_keys = _rename_basic_caffe2_alexnet_weights(layer_keys)
      elif weights_type == "torch" and model_name == "deepcluster":
          layer_keys = _rename_basic_alexnet_deepcluster_weights(
              layer_keys
          )
      elif weights_type == "torch" and model_name == "rotnet":
          logger.info(
              "Found rotnet torch weights compatible with vissl"
          )
      key_map = {k: v for k, v in zip(original_keys, layer_keys)}
  
      logger.info("Remapping weights....")
      new_weights = OrderedDict()
      for k in original_keys:
          if weights_type == "torch":
              v = np.array(weights[k].cpu())
          else:
              v = np.array(weights[k])
          if any(x in k for x in _SKIP_LAYERS):
              continue
          if k == "lr":
              continue
          if k == "model_iter":
              continue
          w = torch.from_numpy(v)
          logger.info(
              f"original name: {k} \t\t mapped name: { key_map[k]}"
          )
          new_weights[key_map[k]] = w
      logger.info("Number of params: {}".format(len(new_weights)))
      return new_weights
  
file_path: vissl/extra_scripts/convert_caffe2_to_vissl_alexnet.py
imports: import argparse
  import logging
  import pickle
  import sys
  from collections import OrderedDict
  import numpy
  import torch
  from iopath.common.file_io import g_pathmgr
label_desc: Use image node_id 8 for calling a global function with example usage: _rename_weights_for_alexnet(weights, weights_type, model_name) and returns: new_weights