class_docstr: Returns a callable that returns the specified integer if evaluated on an array.
  Otherwise, it returns `None`.
  
  !!! Example
  
      ```python
      fn = if_array(1)
      # Evaluate on an array, return the integer.
      fn(jax.numpy.array([0, 1, 2]))  # 1
      # Evaluate on not-an-array, return None.
      fn(True)  # None
      ```
class_docstr_tok: ["Returns","a","callable","that","returns","the","specified","integer","if","evaluated","on","an","array",".","Otherwise",",","it","returns","`","None","`",".","!","!","!","Example","``","`","python","fn","=","if_array","(","1",")","#","Evaluate","on","an","array",",","return","the","integer",".","fn","(","jax.numpy.array","(","[","0",",","1",",","2","]",")",")","#","1","#","Evaluate","on","not-an-array",",","return","None",".","fn","(","True",")","#","None","``","`"]
code: def __call__(self, x: Any) -> Optional[int]:
      return self.axis if is_array(x) else None
  
imports: import dataclasses
  import functools
  import inspect
  import warnings
  from collections.abc import Callable, Hashable
  from typing import Any, Literal, Optional, overload, Union
  import jax
  import jax._src.traceback_util
  import jax.core
  import jax.interpreters.batching
  import jax.interpreters.pxla
  import jax.numpy
  import jax.tree_util
  import numpy
  from jaxtyping import PyTree
  from ._compile_utils import compile_cache, hashable_combine, hashable_partition, Lowered
  from ._custom_types import sentinel
  from ._deprecate import deprecated_0_10
  from ._doc_utils import doc_remove_args
  from ._filters import combine, filter, is_array, is_array_like, partition
  from ._module import Module, module_update_wrapper, Partial, Static
label_desc: Use image node_id 1 for calling the if_array obj's underlying member method code with example usage: obj.__call__(x) and returns: unknown