code: def test_methods(call, outer):
      num_traces = 0
  
      class M(eqx.Module):
          increment: Union[int, jax.Array]
  
          if call:
  
              def __call__(self, x):
                  nonlocal num_traces
                  num_traces += 1
                  return x + self.increment
  
              if not outer:
                  __call__ = eqx.filter_jit(__call__)
          else:
  
              def method(self, x):
                  nonlocal num_traces
                  num_traces += 1
                  return x + self.increment
  
              if not outer:
                  method = eqx.filter_jit(method)
  
      def run(_m):
          y = jnp.array(1.0)
          if call:
              if outer:
                  return eqx.filter_jit(_m)(y)
              else:
                  return _m(y)
          else:
              if outer:
                  return eqx.filter_jit(_m.method)(y)
              else:
                  return _m.method(y)
  
      m = M(1)
      assert run(m) == 2
      assert run(m) == 2
      assert num_traces == 1
      n = M(2)
      assert run(n) == 3
      assert run(n) == 3
      assert num_traces == 2
      o = M(jnp.array(1))
      p = M(jnp.array(2))
      assert run(o) == 2
      assert run(p) == 3
      assert num_traces == 3
  
imports: import warnings
  from typing import Union
  import equinox
  import jax
  import jax.numpy
  import jax.random
  import jax.tree_util
  import pytest
  from .helpers import tree_allclose
label_desc: Use image node_id 3 for calling a global function with example usage: test_methods(call, outer) and returns: unknown, unknown, eqx, _m, eqx, _m