code: def embedding(
      weights: np.ndarray,
      indices: np.ndarray,
      /,
      *,
      max_norm: Optional[int] = None,
      out: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      ivy.utils.assertions.check_equal(
          len(weights.shape),
          2,
          message="weights must be 2-d",
          as_array=False,
      )
  
      embeddings = np.take(weights, indices, axis=0)
      if max_norm is not None:
          norms = np.linalg.norm(embeddings, axis=-1, keepdims=True)
          embeddings = np.where(
              norms > max_norm,
              embeddings * max_norm / norms,
              embeddings,
          )
          embeddings = np.where(
              norms < -max_norm,
              embeddings * -max_norm / norms,
              embeddings,
          )
      return embeddings
  
imports: import math
  import numpy
  from typing import Optional, Union, Tuple, List, Literal, Sequence, Callable
  import ivy
  from ivy.functional.ivy.layers import _handle_padding, _get_num_padded_values, _validate_max_pool_params, _depth_max_pooling_helper
  from ivy.functional.backends.numpy.layers import _add_dilations
  from ivy.functional.ivy.experimental.layers import _padding_ceil_mode
  from ivy.func_wrapper import with_supported_dtypes
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
label_desc: Use image node_id 18 for calling a global function with example usage: embedding() and returns: embeddings