code: def test_hidden_output(hidden_output_params):
      model, layer, flatten = hidden_output_params
      model = Model1() if model == 1 else model2
      X_hidden = HiddenOutput(
          model=model, layer=layer, flatten=flatten
      )(torch.from_numpy(X))
      if layer == 0:
          assert_shape = (n, dim1, dim2)
      elif layer == 1:
          assert_shape = (n, dim1, n_hidden)
      elif layer == 2:
          assert_shape = (n, dim1, n_classes)
      if flatten:
          assert_shape = (assert_shape[0],) + (
              np.prod(assert_shape[1:]),
          )
      assert X_hidden.shape == assert_shape
  
file_path: alibi-detect/alibi_detect/cd/pytorch/tests/test_preprocess_pt.py
imports: from itertools import product
  import numpy
  import pytest
  import torch
  import torch.nn
  from alibi_detect.cd.pytorch import HiddenOutput
label_desc: Use image node_id 2 for calling a global function with example usage: test_hidden_output(hidden_output_params) without return types