code: def test_rename(self):
      vc = objax.VarCollection(
          {
              "baab": objax.TrainVar(jn.zeros(()) + 1),
              "baaab": objax.TrainVar(jn.zeros(()) + 2),
              "baaaab": objax.TrainVar(jn.zeros(()) + 3),
              "abba": objax.TrainVar(jn.zeros(()) + 4),
              "acca": objax.TrainVar(jn.zeros(()) + 5),
          }
      )
      vcr = vc.rename(objax.util.Renamer({"aa": "x", "bb": "y"}))
      self.assertEqual(vc["baab"], vcr["bxb"])
      self.assertEqual(vc["baaab"], vcr["bxab"])
      self.assertEqual(vc["baaaab"], vcr["bxxb"])
      self.assertEqual(vc["abba"], vcr["aya"])
      self.assertEqual(vc["acca"], vcr["acca"])
  
      def my_rename(x):
          return x.replace("aa", "x").replace("bb", "y")
  
      vcr = vc.rename(objax.util.Renamer(my_rename))
      self.assertEqual(vc["baab"], vcr["bxb"])
      self.assertEqual(vc["baaab"], vcr["bxab"])
      self.assertEqual(vc["baaaab"], vcr["bxxb"])
      self.assertEqual(vc["abba"], vcr["aya"])
      self.assertEqual(vc["acca"], vcr["acca"])
  
      vcr = vc.rename(
          objax.util.Renamer(
              [(re.compile("a{2}"), "x"), (re.compile("bb"), "y")]
          )
      )
      self.assertEqual(vc["baab"], vcr["bxb"])
      self.assertEqual(vc["baaab"], vcr["bxab"])
      self.assertEqual(vc["baaaab"], vcr["bxxb"])
      self.assertEqual(vc["abba"], vcr["aya"])
      self.assertEqual(vc["acca"], vcr["acca"])
  
      vcr = vc.rename(
          objax.util.Renamer(
              [(re.compile("a{2}"), "x"), (re.compile("xa"), "y")]
          )
      )
      self.assertEqual(vc["baab"], vcr["bxb"])
      self.assertEqual(vc["baaab"], vcr["byb"])
      self.assertEqual(vc["baaaab"], vcr["bxxb"])
      self.assertEqual(vc["abba"], vcr["abba"])
      self.assertEqual(vc["acca"], vcr["acca"])
  
file_path: objax/tests/var_collection.py
imports: import re
  import unittest
  import jax.numpy
  import objax
  from objax.zoo import wide_resnet
label_desc: Use image node_id 9 for calling the TestVarCollection obj's underlying member method code with example usage: obj.test_rename() and returns: x