code: def hamming(M):
      """Returns the Hamming window.
  
      The Hamming window is defined as
  
      .. math::
          w(n) = 0.54 - 0.46\\cos\\left(\\frac{2\\pi{n}}{M-1}\\right)
          \\qquad 0 \\leq n \\leq M-1
  
      Args:
          M (:class:`~int`):
              Number of points in the output window. If zero or less, an empty
              array is returned.
  
      Returns:
          ~cupy.ndarray: Output ndarray.
  
      .. seealso:: :func:`numpy.hamming`
      """
      if M == 1:
          return cupy.ones(1, dtype=cupy.float64)
      if M <= 0:
          return cupy.array([])
      alpha = numpy.pi * 2 / (M - 1)
      out = cupy.empty(M, dtype=cupy.float64)
      return _hamming_kernel(alpha, out)
  
imports: import numpy
  import cupy
  from cupy import _core
label_desc: Use image node_id 3 for calling a global function with example usage: hamming(M) and returns: _hamming_kernel, cupy, cupy