code: def _dilate_shape(shape: jnp.ndarray, dilation: Tuple[int, ...]):
      """Utility function for computing the shape resulting from a dilation.
  
      Args:
        shape: Shapes (input or kernel i.e. lhr or rhs) to which the dilation should
          be applied.
        dilation: The dilation to apply.
  
      Returns:
        Dilated input shapes.
      """
      if not np.all(np.greater(dilation, 0)):
          raise TypeError(
              f"All dilations must be positive, got {dilation}."
          )
      dilation = (1,) * (shape.shape[1] - len(dilation)) + tuple(
          dilation
      )
      dilation = jnp.array(dilation)
      return jnp.where(
          shape == 0,
          0,
          jnp.multiply(dilation, jnp.subtract(shape, 1)) + 1,
      )
  
imports: import functools
  from typing import Optional, Tuple, Union, Callable, Any, Sequence, List, Iterable
  import flax.linen
  import jax
  from jax import lax
  import jax.numpy
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: _dilate_shape(shape, dilation) and returns: jnp