code: def test_get_random_layer_generator(load_mnist_model_tf):
      tf_model = load_mnist_model_tf
      model = TensorFlowModel(model=tf_model, channel_first=False)
      before = model.state_dict()
      old_weights = {
          s.name: s.get_weights() for s in list(tf_model.layers)
      }
  
      for (
          layer_name,
          random_layer_model,
      ) in model.get_random_layer_generator():
          old = old_weights[layer_name]
          new = random_layer_model.get_layer(layer_name).get_weights()
  
          assert reduce(
              and_, [not np.allclose(x, y) for x, y in zip(old, new)]
          ), "Test failed."
  
      after = model.state_dict()
  
      # Make sure the original model is unaffected
      assert reduce(
          and_, [np.allclose(x, y) for x, y in zip(before, after)]
      ), "Test failed."
  
file_path: Quantus/tests/helpers/test_tf_model.py
imports: from functools import reduce
  from operator import and_
  from typing import Union
  import tensorflow
  import numpy
  import pytest
  from pytest_lazyfixture import lazy_fixture
  from scipy.special import softmax
  from quantus.helpers.model.tf_model import TensorFlowModel
label_desc: Use image node_id 4 for calling a global function with example usage: test_get_random_layer_generator(load_mnist_model_tf) without return types