code: def test_non_trainable_layer_warnings_tf():
      """Test non-trainable layer warnings `tensorflow`.
  
      Test that warnings are raised when user passes non-trainable layers to `GradientSimilarity` method for
      `tensorflow` models.
  
      Note: `Keras` batch norm layers register non-trainable weights by default and so will raise the
      warning we test for here. This is different to the `pytorch` behavour which doesn't include
      the batch norm parameters in ``model.parameters()``.
      """
      model = keras.Sequential(
          [
              keras.layers.Dense(10),
              keras.layers.Dense(20),
              keras.layers.BatchNormalization(),
              keras.Sequential(
                  [
                      keras.layers.Dense(30),
                      keras.layers.Dense(40),
                  ]
              ),
          ]
      )
  
      # GradientSimilarity method checks weights are trainable so we need to build the model before passing it to the
      # method
      model.build((None, 10))
  
      model.layers[1].trainable = False
      model.layers[-1].layers[1].trainable = False
      num_params_non_trainable = len(model.non_trainable_weights)
      loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(
          from_logits=True
      )
  
      with pytest.warns(Warning) as record:
          GradientSimilarity(
              model,
              task="classification",
              loss_fn=loss_fn,
              backend="tensorflow",
          )
  
      assert (
          f"Found {num_params_non_trainable} non-trainable parameters in the model. These parameters "
          "don't have gradients and will not be included in the computation of gradient similarity."
          " This might be because your model has layers that track statistics using non-trainable "
          "parameters such as batch normalization layers. In this case, you don't need to worry. "
          "Otherwise it's because you have set some parameters to be non-trainable and alibi is "
          "letting you know."
      ) == str(record[0].message)
  
imports: import pytest
  import numpy
  import torch.nn
  import torch
  import tensorflow
  from tensorflow import keras
  from alibi.explainers.similarity.grad import GradientSimilarity
label_desc: Use image node_id 17 for calling a global function with example usage: test_non_trainable_layer_warnings_tf() without return types