code: def _compute_newshape(
      a: ArrayLike, newshape: DimSize | Shape
  ) -> Shape:
      """Fixes a -1 value in newshape, if present."""
      orig_newshape = newshape  # for error messages
      try:
          iter(newshape)  # type: ignore[arg-type]
      except:
          newshape = [newshape]
      newshape = core.canonicalize_shape(newshape)  # type: ignore[arg-type]
      neg1s = [
          i
          for i, d in enumerate(newshape)
          if type(d) is int and d == -1
      ]
      if len(neg1s) > 1:
          raise TypeError(
              "can only specify one unknown axis size with a `-1` value, "
              f"got {orig_newshape}"
          )
      if neg1s:
          (i,) = neg1s
          other_sizes = (*newshape[:i], *newshape[i + 1 :])
          if (
              all(
                  isinstance(d, int)
                  for d in (*np.shape(a), *other_sizes)
              )
              and np.size(a) % math.prod(other_sizes) != 0
          ):
              raise TypeError(
                  f"cannot reshape array of shape {np.shape(a)} (size {np.size(a)}) "
                  f"into shape {orig_newshape} because the product of "
                  f"specified axis sizes ({math.prod(other_sizes)}) does "
                  f"not evenly divide {np.size(a)}"
              )
          sz = core.cancel_divide_tracers(np.shape(a), other_sizes)
          if sz is not None:
              return (*newshape[:i], sz, *newshape[i + 1 :])
      else:
          if all(
              isinstance(d, int) for d in (*np.shape(a), *newshape)
          ) and np.size(a) != math.prod(newshape):
              raise TypeError(
                  f"cannot reshape array of shape {np.shape(a)} (size {np.size(a)}) "
                  f"into shape {orig_newshape} (size {math.prod(newshape)})"
              )
      return tuple(
          -core.divide_shape_sizes(np.shape(a), newshape)
          if core.definitely_equal(d, -1)
          else d
          for d in newshape
      )
  
imports: from __future__ import annotations
  import abc
  from functools import partial, wraps
  import math
  from typing import Any
  import numpy
  import jax
  from jax import lax
  from jax._src import core
  from jax._src import dtypes
  from jax._src.api_util import _ensure_index_tuple
  from jax._src.array import ArrayImpl
  from jax._src.lax import lax
  from jax._src.numpy import lax_numpy
  from jax._src.numpy import reductions
  from jax._src.numpy import ufuncs
  from jax._src.numpy import util
  from jax._src.ops import scatter
  from jax._src.typing import Array, ArrayLike, DimSize, DTypeLike, Shape
  from jax._src.util import safe_zip, safe_map
label_desc: Use image node_id 7 for calling a global function with example usage: _compute_newshape(a, newshape) and returns: tuple, unknown,  sz,  unknown