code: def matrix_set_diag(data, diagonal, k=0, align="RIGHT_LEFT"):
      """Returns a tensor with the diagonals of input tensor replaced with the provided
      diagonal values.
  
      Parameters
      ----------
      data : relay.Expr
          Input tensor.
  
      diagonal : relay.Expr
          Values to be filled in the diagonal.
  
      k : int or tuple of int, optional
          Diagonal offset(s). The diagonal or range of diagonals to set. (0 by default)
          Positive value means superdiagonal, 0 refers to the main diagonal, and
          negative value means subdiagonals. k can be a single integer (for a single diagonal)
          or a pair of integers specifying the low and high ends of a matrix band.
          k[0] must not be larger than k[1].
  
      align : string, optional
          Some diagonals are shorter than max_diag_len and need to be padded.
          align is a string specifying how superdiagonals and subdiagonals should be aligned,
          respectively. There are four possible alignments: "RIGHT_LEFT" (default), "LEFT_RIGHT",
          "LEFT_LEFT", and "RIGHT_RIGHT". "RIGHT_LEFT" aligns superdiagonals to the right
          (left-pads the row) and subdiagonals to the left (right-pads the row). It is the packing
          format LAPACK uses. cuSPARSE uses "LEFT_RIGHT", which is the opposite alignment.
  
      Returns
      -------
      result : relay.Expr
          New tensor with given diagonal values.
  
      Examples
      --------
      .. code-block:: python
  
          data = [[[7, 7, 7, 7],
                   [7, 7, 7, 7],
                   [7, 7, 7, 7]],
                  [[7, 7, 7, 7],
                   [7, 7, 7, 7],
                   [7, 7, 7, 7]]]
  
          diagonal = [[1, 2, 3],
                      [4, 5, 6]]
  
          relay.matrix_set_diag(input, diagonal) =
              [[[1, 7, 7, 7],
                [7, 2, 7, 7],
                [7, 7, 3, 7]],
               [[4, 7, 7, 7],
                [7, 5, 7, 7],
                [7, 7, 6, 7]]]
      """
      if isinstance(k, (tuple, list)):
          k_one = k[0]
          if len(k) >= 2:
              k_two = k[1]
          else:
              k_two = k[0]
      else:
          k_one = k
          k_two = k
  
      super_diag_right_align = align[:5] == "RIGHT"
      sub_diag_right_align = align[-5:] == "RIGHT"
  
      return _make.matrix_set_diag(
          data,
          diagonal,
          k_one,
          k_two,
          super_diag_right_align,
          sub_diag_right_align,
      )
  
imports: from ...tir import expr
  from ..expr import Constant, Expr, Tuple, TupleWrapper, const
  from .None import _make
  from .dyn import _make
  from .tensor import shape_of
label_desc: Use image node_id 39 for calling a global function with example usage: matrix_set_diag(data, diagonal, k, align) and returns: _make