24#ifndef TVM_TOPI_NN_RMS_NORM_H_
25#define TVM_TOPI_NN_RMS_NORM_H_
51 double epsilon, std::string name =
"T_rms_norm",
70 auto rsqrt_func = [&](
const ffi::Array<PrimVar>& indices) {
72 for (
int i = 0,
n =
static_cast<int>(indices.size());
i <
n; ++
i) {
82 for (
int i = 0,
n =
static_cast<int>(
data_fp32->shape.size());
i <
n; ++
i) {
89 auto rms_norm_func = [&](
const ffi::Array<PrimVar>& indices) {
91 for (
int i = 0,
n =
static_cast<int>(indices.size());
i <
n; ++
i) {
Definition base_expr.h:137
static PrimType Float(int bits, int lanes=1)
Construct a floating-point type with fixed lanes.
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Tensor structure representing a possible input, or intermediate computation result.
Definition tensor.h:98
Tensor expression language DSL.
Definition extracted_task.h:33
Tensor compute(ffi::Array< PrimExpr > shape, FCompute fcompute, std::string name="tensor", std::string tag="", ffi::Map< ffi::String, ffi::Any > attrs={})
Construct a new tensor by computing over shape, using the computation rule: result_tensor[axis] = fco...
const Op & cast()
See pesudo code below:
PrimExpr MakeConst(PrimType dtype, ValueType value, Span span=Span())
Make a const value with certain data type.
Definition op.h:1002
Tensor rms_norm(const Tensor &data, const Tensor &weight, const ffi::Array< int64_t > &axis, double epsilon, std::string name="T_rms_norm", std::string tag=kInjective)
Root mean square normalization.
Definition rms_norm.h:50
std::vector< int > GetRealAxis(int ndim, const ffi::Optional< ffi::Array< int64_t > > &axis)
Convert a reduction axis which could be empty or have negative elements into a real axis with valid d...
Definition reduction.h:65
constexpr auto kInjective
Definition tags.h:33
tvm::PrimExpr multiply(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition broadcast.h:227
Tensor rsqrt(const Tensor &x, std::string name="tensor", std::string tag=kElementWise)
Creates an operation that returns rsqrt of a given tensor.
Definition elemwise.h:234
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40
PrimExpr rsqrt(PrimExpr x, Span span=Span())
Definition op.h:759
Operation node can generate one or multiple Tensors.
Reduction op constructors.