code: def all_inputs_are_scalar(node):
      """Check whether all the inputs of an `Elemwise` are scalar values.
  
      `jax.lax` or `jax.numpy` functions systematically return `TracedArrays`,
      while the corresponding Python operators return concrete values when passed
      concrete values. In order to be able to compile the largest number of graphs
      possible we need to preserve concrete values whenever we can. We thus need
      to dispatch differently the PyTensor operators depending on whether the inputs
      are scalars.
  
      """
      ndims_input = [inp.type.ndim for inp in node.inputs]
      are_inputs_scalars = True
      for ndim in ndims_input:
          try:
              if ndim > 0:
                  are_inputs_scalars = False
          except TypeError:
              are_inputs_scalars = False
  
      return are_inputs_scalars
  
imports: import functools
  import typing
  from typing import Callable, Optional
  import jax
  import jax.numpy
  from pytensor.link.jax.dispatch.basic import jax_funcify
  from pytensor.scalar import Softplus
  from pytensor.scalar.basic import Add, Cast, Clip, Composite, Identity, IntDiv, Mod, Mul, ScalarOp, Second, Sub
  from pytensor.scalar.math import BetaIncInv, Erf, Erfc, Erfcinv, Erfcx, Erfinv, GammaIncCInv, GammaIncInv, Iv, Ive, Log1mexp, Psi, TriGamma
label_desc: Use image node_id 2 for calling a global function with example usage: all_inputs_are_scalar(node) and returns: are_inputs_scalars