code: def fill_off_diagonal(
      x: np.ndarray, *, radius: float, value: float = 0
  ) -> None:
      """Set all cells of a matrix to a given ``value``
      if they lie outside a constraint region.
  
      In this case, the constraint region is the
      Sakoe-Chiba band which runs with a fixed ``radius``
      along the main diagonal.
  
      When ``x.shape[0] != x.shape[1]``, the radius will be
      expanded so that ``x[-1, -1] = 1`` always.
  
      ``x`` will be modified in place.
  
      Parameters
      ----------
      x : np.ndarray [shape=(N, M)]
          Input matrix, will be modified in place.
      radius : float
          The band radius (1/2 of the width) will be
          ``int(radius*min(x.shape))``
      value : float
          ``x[n, m] = value`` when ``(n, m)`` lies outside the band.
  
      Examples
      --------
      >>> x = np.ones((8, 8))
      >>> librosa.util.fill_off_diagonal(x, radius=0.25)
      >>> x
      array([[1, 1, 0, 0, 0, 0, 0, 0],
             [1, 1, 1, 0, 0, 0, 0, 0],
             [0, 1, 1, 1, 0, 0, 0, 0],
             [0, 0, 1, 1, 1, 0, 0, 0],
             [0, 0, 0, 1, 1, 1, 0, 0],
             [0, 0, 0, 0, 1, 1, 1, 0],
             [0, 0, 0, 0, 0, 1, 1, 1],
             [0, 0, 0, 0, 0, 0, 1, 1]])
      >>> x = np.ones((8, 12))
      >>> librosa.util.fill_off_diagonal(x, radius=0.25)
      >>> x
      array([[1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
             [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
             [0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
             [0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
             [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0],
             [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
             [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1],
             [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]])
      """
      nx, ny = x.shape
  
      # Calculate the radius in indices, rather than proportion
      radius = int(np.round(radius * np.min(x.shape)))
  
      nx, ny = x.shape
      offset = np.abs((x.shape[0] - x.shape[1]))
  
      if nx < ny:
          idx_u = np.triu_indices_from(x, k=radius + offset)
          idx_l = np.tril_indices_from(x, k=-radius)
      else:
          idx_u = np.triu_indices_from(x, k=radius)
          idx_l = np.tril_indices_from(x, k=-radius - offset)
  
      # modify input matrix
      x[idx_u] = value
      x[idx_l] = value
  
imports: from __future__ import annotations
  import scipy.ndimage
  import scipy.sparse
  import numpy
  import numba
  from numpy.lib.stride_tricks import as_strided
  from .._cache import cache
  from .exceptions import ParameterError
  from .deprecation import Deprecated
  from numpy.typing import ArrayLike, DTypeLike
  from typing import Any, Callable, Iterable, List, Dict, Optional, Sequence, Tuple, TypeVar, Union, overload
  from typing_extensions import Literal
  from .._typing import _SequenceLike, _FloatLike_co, _ComplexLike_co
label_desc: Use image node_id 27 for calling a global function with example usage: fill_off_diagonal(x) without return types