code: def test_clears_bijector_cache_and_deepcopy(
      module: Type[Any],
  ) -> None:
      """
      With each forward pass through a bijector, a cache is stored inside which prohibits the deepcopy of the bijector.
      This is due to the fact that HashableWeakRef objects are not pickle-able, which raises a TypeError. Alternatively,
      one can make use of `deepcopy_component` to deepcopy a module containing used bijectors.
      """
      input = 1.0
      _ = module(input)
  
      if Version(tfp.__version__) >= Version("0.12"):
          module_copy = copy.deepcopy(module)
      else:
          # older versions of tensorflow_probability required us to maintain a workaround
          with pytest.raises(TypeError):
              copy.deepcopy(module)
          module_copy = gpflow.utilities.deepcopy(module)
  
      assert module.var == module_copy.var
      assert module.var is not module_copy.var
      module_copy.var.assign([5.0])
      assert module.var != module_copy.var
  
imports: import copy
  import pickle
  from typing import Any, Type
  import pytest
  import tensorflow
  import tensorflow_probability
  from check_shapes import check_shapes
  from packaging.version import Version
  import gpflow
  from gpflow.base import TensorType
label_desc: Use image node_id 1 for calling a global function with example usage: test_clears_bijector_cache_and_deepcopy(module) without return types