code: def vq(obs, code_book, check_finite=True):
      check_arraylike("scipy.cluster.vq.vq", obs, code_book)
      if obs.ndim != code_book.ndim:
          raise ValueError(
              "Observation and code_book should have the same rank"
          )
      obs, code_book = promote_dtypes_inexact(obs, code_book)
      if obs.ndim == 1:
          obs, code_book = obs[..., None], code_book[..., None]
      if obs.ndim != 2:
          raise ValueError(
              "ndim different than 1 or 2 are not supported"
          )
  
      # explicitly rank promotion
      dist = vmap(
          lambda ob: jnp.linalg.norm(ob[None] - code_book, axis=-1)
      )(obs)
      code = jnp.argmin(dist, axis=-1)
      dist_min = vmap(operator.getitem)(dist, code)
      return code, dist_min
  
imports: import operator
  import scipy.cluster.vq
  import textwrap
  from jax import vmap
  import jax.numpy
  from jax._src.numpy.util import _wraps, check_arraylike, promote_dtypes_inexact
label_desc: Use image node_id 1 for calling a global function with example usage: vq(obs, code_book, check_finite) and returns: code,  dist_min