code: def test_not_trainable_model_error_torch():
      """Test non-trainable model error `pytorch`."""
  
      model = nn.Linear(2, 1, bias=False)
      model.requires_grad_(False)
  
      with pytest.raises(ValueError) as err:
          GradientSimilarity(
              model,
              task="regression",
              loss_fn=loss_tf,
              sim_fn="grad_dot",
              backend="pytorch",
          )
  
      assert err.value.args[0] == (
          "The model has no trainable parameters. This method requires at least "
          "one trainable parameter to compute the gradients for. "
          "Try setting ``.requires_grad_(True)`` on the model or one of its parameters."
      )
  
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 20 for calling a global function with example usage: test_not_trainable_model_error_torch() without return types