code: def histogram(
      a: Union[ivy.Array, ivy.NativeArray],
      /,
      *,
      bins: Optional[Union[int, ivy.Array, ivy.NativeArray]] = None,
      axis: Optional[int] = None,
      extend_lower_interval: Optional[bool] = False,
      extend_upper_interval: Optional[bool] = False,
      dtype: Optional[Union[ivy.Dtype, ivy.NativeDtype]] = None,
      range: Optional[Tuple[float]] = None,
      weights: Optional[Union[ivy.Array, ivy.NativeArray]] = None,
      density: Optional[bool] = False,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Compute the histogram of the array ``a``.
  
      .. note::
          Given bins = [c0, ..., cK], defining intervals I0 = [c0, c1), I1 = [c1, c2),
          ..., I_{K-1} = [c_{K-1}, cK].
  
      Parameters
      ----------
      a
          input array.
      bins
          if ``bins`` is an int, it defines the number of equal-width bins in the given
          range.
          if ``bins`` is an array, it defines a monotonically increasing array of bin
          edges, including the rightmost edge, allowing for non-uniform bin widths.
      axis
          dimension along which maximum values must be computed. By default, the maximum
          value must be computed over the entire array. Default: ``None``.
      extend_lower_interval
          if True, extend the lowest interval I0 to (-inf, c1].
      extend_upper_interval
          ff True, extend the upper interval I_{K-1} to [c_{K-1}, +inf).
      dtype
          the output type.
      range
          the lower and upper range of the bins. The first element of the range must be
          less than or equal to the second.
      weights
          each value in ``a`` only contributes its associated weight towards the bin count
          (instead of 1). Must be of the same shape as a.
      density
          if True, the result is the value of the probability density function at the
          bin, normalized such that the integral over the range of bins is 1.
      out
          optional output array, for writing the result to. It must have a shape that the
          inputs broadcast to.
  
      Returns
      -------
      ret
          a tuple containing the values of the histogram and the bin edges.
  
      Both the description and the type hints above assumes an array input for simplicity,
      but this function is *nestable*, and therefore also accepts :class:`ivy.Container`
      instances in place of any of the arguments.
  
      Examples
      --------
      With :class:`ivy.Array` input:
  
      >>> x = ivy.array([0, 1, 2])
      >>> y = ivy.array([0., 0.5, 1., 1.5, 2.])
      >>> z = ivy.histogram(x, bins=y)
      >>> print(z)
      ivy.array([1., 0., 1., 1.])
  
      >>> x = ivy.array([[1.1, 2.2, 3.3],
      ...                [4.4, 5.5, .6]])
      >>> bins = 4
      >>> range = (0., 5.)
      >>> dtype = ivy.int32
      >>> y = ivy.histogram(x, bins=bins, range=range, dtype=dtype)
      >>> print(y)
      ivy.array([2, 1, 1, 1])
  
      >>> x = ivy.array([[1.1, 2.2, 3.3],
      ...                [-4.4, -5.5, -6.6]])
      >>> y = ivy.array([0., 1., 2., 3., 4., 5.])
      >>> axis = 1
      >>> extend_lower_interval = True
      >>> extend_upper_interval = True
      >>> dtype = ivy.float32
      >>> weights = ivy.array([[1., 1., 1.], [1., 1., 1.]])
      >>> z = ivy.histogram(
      ...                     x,
      ...                     bins=y,
      ...                     axis=axis,
      ...                     extend_lower_interval=extend_lower_interval,
      ...                     extend_upper_interval=extend_upper_interval,
      ...                     dtype=dtype,
      ...                     weights=weights)
      >>> print(z)
      ivy.array([[0., 3.],
             [1., 0.],
             [1., 0.],
             [1., 0.],
             [0., 0.]])
  
      >>> x = ivy.Container(a=ivy.array([0., 1., 2.]), b=ivy.array([3., 4., 5.]))
      >>> y = ivy.array([0., 1., 2., 3., 4., 5.])
      >>> dtype = ivy.int32
      >>> z = ivy.histogram(x, bins=y, dtype=dtype)
      >>> print(z)
      {
          a: ivy.array([1, 1, 1, 0, 0]),
          b: ivy.array([0, 0, 0, 1, 2])
      }
      """
      return ivy.current_backend(a).histogram(
          a,
          bins=bins,
          axis=axis,
          extend_lower_interval=extend_lower_interval,
          extend_upper_interval=extend_upper_interval,
          dtype=dtype,
          range=range,
          weights=weights,
          density=density,
          out=out,
      )
  
file_path: ivy/ivy/functional/ivy/experimental/statistical.py
imports: from typing import Optional, Union, Tuple, Sequence
  import ivy
  from ivy.func_wrapper import handle_array_function, handle_out_argument, to_native_arrays_and_back, handle_array_like_without_promotion, handle_nestable, infer_dtype, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 1 for calling a global function with example usage: histogram() and returns: ivy