code: def decl_tensor_intrin(
      op,
      fcompute,
      name="tensor_intrin",
      binds=None,
      scalar_params=None,
      default_buffer_params=None,
  ):
      """Declare a tensor intrinsic function.
  
      Parameters
      ----------
      op: Operation
          The symbolic description of the intrinsic operation
  
      fcompute: lambda function of inputs, outputs-> stmt
          Specifies the IR statement to do the computation.
          See the following note for function signature of fcompute
  
          .. note::
               **Parameters**
  
               - **ins** (list of :any:`tvm.tir.Buffer`) - Placeholder for each inputs
               - **outs** (list of :any:`tvm.tir.Buffer`) - Placeholder for each outputs
  
               **Returns**
  
               - **stmt** (:any:`tvm.tir.Stmt`, or tuple of three stmts)
               - If a single stmt is returned, it represents the body
               - If tuple of three stmts are returned they corresponds to body,
                 reduce_init, reduce_update
  
      name: str, optional
          The name of the intrinsic.
  
      binds: dict of :any:`Tensor` to :any:`tvm.tir.Buffer`, optional
          Dictionary that maps the Tensor to Buffer which specified the data layout
          requirement of the function. By default, a new compact buffer is created
          for each tensor in the argument.
  
      scalar_params: a list of variables used by op, whose values will be passed
                     as scalar_inputs when the tensor intrinsic is called.
  
      default_buffer_params: Optional[dict]
          Dictionary of buffer arguments to be passed when constructing a buffer.
  
      Returns
      -------
      intrin: TensorIntrin
          A TensorIntrin that can be used in tensorize schedule.
      """
      if not isinstance(op, _tensor.Operation):
          raise TypeError("expect Operation")
      inputs = op.input_tensors
      binds = binds if binds else {}
      tensors = list(inputs)
      for i in range(op.num_outputs):
          tensors.append(op.output(i))
  
      binds_list = []
      for t in inputs:
          if not isinstance(t.op, PlaceholderOp):
              raise ValueError("Do not yet support composition op")
  
      default_buffer_params = (
          {} if default_buffer_params is None else default_buffer_params
      )
      for t in tensors:
          buf = (
              binds[t]
              if t in binds
              else tvm.tir.decl_buffer(
                  t.shape, t.dtype, t.op.name, **default_buffer_params
              )
          )
          binds_list.append(buf)
  
      if scalar_params:
          body = fcompute(
              binds_list[: len(inputs)],
              binds_list[len(inputs) :],
              scalar_params,
          )
      else:
          body = fcompute(
              binds_list[: len(inputs)], binds_list[len(inputs) :]
          )
          scalar_params = []
      if isinstance(body, (tvm.tir.PrimExpr, tvm.tir.Stmt)):
          body = [body]
      body = [
          tvm.tir.Evaluate(x) if isinstance(x, tvm.tir.PrimExpr) else x
          for x in body
      ]
      if len(body) < 3:
          body += [None] * (3 - len(body))
      return _ffi_api.TensorIntrin(
          name, op, inputs, binds_list, scalar_params, *body
      )
  
file_path: tvm/python/tvm/te/tensor_intrin.py
imports: import tvm._ffi
  import tvm.tir
  from tvm.runtime import Object, convert
  from tvm.ir import Range
  from .tensor import PlaceholderOp
  from .None import tensor
  from .None import _ffi_api
label_desc: Use image node_id 2 for calling a global function with example usage: decl_tensor_intrin(op, fcompute, name, binds, scalar_params, default_buffer_params) and returns: _ffi_api