code: def _pformat_array(
      obj: Union[
          jax.Array,
          jax.ShapeDtypeStruct,
          np.ndarray,
          "torch.Tensor",  # pyright: ignore  # noqa: F821
      ],
      **kwargs,
  ) -> pp.Doc:
      short_arrays = kwargs["short_arrays"]
      if short_arrays:
          # Support torch here for the sake of jaxtyping's pretty-printed error messages.
          if "torch" in sys.modules and isinstance(
              obj, sys.modules["torch"].Tensor
          ):
              dtype = repr(obj.dtype).split(".")[1]
              kind = "torch"
          else:
              dtype = obj.dtype.name
              if isinstance(obj, (jax.Array, jax.ShapeDtypeStruct)):
                  kind = None
              elif isinstance(obj, np.ndarray):
                  kind = "numpy"
              else:
                  kind = "unknown"
          return _pformat_short_array(obj.shape, dtype, kind)
      else:
          return pp.text(repr(obj))
  
imports: import dataclasses
  import functools
  import sys
  import types
  from collections.abc import Callable, Sequence
  from typing import Any, Optional, Union
  import jax
  import jax._src.pretty_printer
  import jax.tree_util
  import numpy
  from jaxtyping import PyTree
  from ._doc_utils import WithRepr
label_desc: Use image node_id 10 for calling a global function with example usage: _pformat_array(obj) and returns: _pformat_short_array, pp