class_docstr: TestCase for analyzers serialization
  
  TestCase that applies the method to several networks and
  runs the analyzer with random data, serializes it, and
  runs it again.
  
  :param method: A function that returns an Analyzer class.
code: def _apply_test(self, model: Model) -> None:
      # Get analyzer.
      analyzer = self._method(model)
      # Dryrun.
      input_shape = model.input_shape[1:]
      x = np.random.rand(1, *input_shape)
      old_analysis = analyzer.analyze(x)
  
      class_name, state = analyzer.save()
      new_analyzer = AnalyzerBase.load(class_name, state)
  
      new_analysis = new_analyzer.analyze(x)
      assert tuple(new_analysis.shape) == (1,) + input_shape
      assert not np.any(np.isinf(new_analysis.ravel()))
      assert not np.any(np.isnan(new_analysis.ravel()))
  
      # Check equality of analysis for all deterministic analyzers
      if not isinstance(analyzer, (Random)):
          assert np.allclose(new_analysis, old_analysis)
  
imports: from __future__ import annotations
  from typing import Callable
  import numpy
  import tensorflow
  import tensorflow.keras.backend
  from innvestigate.analyzer import Random
  from innvestigate.analyzer.base import AnalyzerBase
  from innvestigate.backend.types import Model
  from tests import networks
label_desc: Use image node_id 3 for calling the SerializeAnalyzerTestCase obj's underlying member method code with example usage: obj._apply_test(model) without return types