code: def test_pickle(self, golden):
      m1 = golden.create_module()
      golden.create_all_variables(m1)
      m2 = pickle.loads(pickle.dumps(m1))
      self.assertIsNot(m1, m2)
  
      # Check that module variables are recreated with equivalent properties.
      for v1, v2 in zip(m1.variables, m2.variables):
          self.assertIsNot(v1, v2)
          self.assertEqual(v1.name, v2.name)
          self.assertEqual(v1.device, v2.device)
          self.assertAllEqual(v1.read_value(), v2.read_value())
  
      if golden.deterministic:
          y1 = golden.forward(m1)
          y2 = golden.forward(m2)
          tree.map_structure(self.assertAllEqual, y1, y2)
  
file_path: sonnet/sonnet/src/conformance/pickle_test.py
imports: import pickle
  from absl.testing import parameterized
  from sonnet.src import test_utils
  from sonnet.src.conformance import goldens
  import tensorflow
  import tree
label_desc: Use image node_id 1 for calling the PickleTest obj's underlying member method code with example usage: obj.test_pickle(golden) without return types