tvm
Namespaces | Macros | Functions
elemwise.h File Reference

Elementwise op constructions. More...

#include <tvm/tir/builtin.h>
#include <tvm/tir/expr.h>
#include <tvm/tir/op.h>
#include <tvm/topi/tags.h>
#include <algorithm>
#include <string>
#include "broadcast.h"
Include dependency graph for elemwise.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 tvm
 runtime implementation for LibTorch/TorchScript.
 
 tvm::topi
 

Macros

#define TOPI_DECLARE_UNARY_OP(OpName)
 

Functions

Tensor tvm::topi::exp (const Tensor &x, std::string name="T_" "exp", std::string tag=kElementWise)
 
Tensor tvm::topi::erf (const Tensor &x, std::string name="T_" "erf", std::string tag=kElementWise)
 
Tensor tvm::topi::sigmoid (const Tensor &x, std::string name="T_" "sigmoid", std::string tag=kElementWise)
 
Tensor tvm::topi::sqrt (const Tensor &x, std::string name="T_" "sqrt", std::string tag=kElementWise)
 
Tensor tvm::topi::log (const Tensor &x, std::string name="T_" "log", std::string tag=kElementWise)
 
Tensor tvm::topi::log2 (const Tensor &x, std::string name="T_" "log2", std::string tag=kElementWise)
 
Tensor tvm::topi::log10 (const Tensor &x, std::string name="T_" "log10", std::string tag=kElementWise)
 
Tensor tvm::topi::floor (const Tensor &x, std::string name="T_" "floor", std::string tag=kElementWise)
 
Tensor tvm::topi::ceil (const Tensor &x, std::string name="T_" "ceil", std::string tag=kElementWise)
 
Tensor tvm::topi::round (const Tensor &x, std::string name="T_" "round", std::string tag=kElementWise)
 
Tensor tvm::topi::trunc (const Tensor &x, std::string name="T_" "trunc", std::string tag=kElementWise)
 
Tensor tvm::topi::abs (const Tensor &x, std::string name="T_" "abs", std::string tag=kElementWise)
 
Tensor tvm::topi::cos (const Tensor &x, std::string name="T_" "cos", std::string tag=kElementWise)
 
Tensor tvm::topi::cosh (const Tensor &x, std::string name="T_" "cosh", std::string tag=kElementWise)
 
Tensor tvm::topi::tan (const Tensor &x, std::string name="T_" "tan", std::string tag=kElementWise)
 
Tensor tvm::topi::sin (const Tensor &x, std::string name="T_" "sin", std::string tag=kElementWise)
 
Tensor tvm::topi::sinh (const Tensor &x, std::string name="T_" "sinh", std::string tag=kElementWise)
 
Tensor tvm::topi::acos (const Tensor &x, std::string name="T_" "acos", std::string tag=kElementWise)
 
Tensor tvm::topi::acosh (const Tensor &x, std::string name="T_" "acosh", std::string tag=kElementWise)
 
Tensor tvm::topi::asin (const Tensor &x, std::string name="T_" "asin", std::string tag=kElementWise)
 
Tensor tvm::topi::asinh (const Tensor &x, std::string name="T_" "asinh", std::string tag=kElementWise)
 
Tensor tvm::topi::atan (const Tensor &x, std::string name="T_" "atan", std::string tag=kElementWise)
 
Tensor tvm::topi::atanh (const Tensor &x, std::string name="T_" "atanh", std::string tag=kElementWise)
 
Tensor tvm::topi::isnan (const Tensor &x, std::string name="T_" "isnan", std::string tag=kElementWise)
 
Tensor tvm::topi::tanh (const Tensor &x, std::string name="T_" "tanh", std::string tag=kElementWise)
 
Tensor tvm::topi::isfinite (const Tensor &x, std::string name="T_" "isfinite", std::string tag=kElementWise)
 
Tensor tvm::topi::isinf (const Tensor &x, std::string name="T_" "isinf", std::string tag=kElementWise)
 
Tensor tvm::topi::fast_tanh_float (const Tensor &in, std::string name, std::string tag)
 Fast_tanh_float implementation from Eigen https://github.com/eigenteam/eigen-git-mirror/blob/master/Eigen/src/Core/MathFunctionsImpl.h#L26. More...
 
Tensor tvm::topi::fast_tanh (const Tensor &x, std::string name="T_fast_tanh", std::string tag=kElementWise)
 Creates an operation that returns hyperbolic tanh of a given tensor. More...
 
Tensor tvm::topi::identity (const Tensor &x, std::string name="T_identity", std::string tag=kElementWise)
 Creates an operation that returns identity of a given tensor. More...
 
Tensor tvm::topi::negative (const Tensor &x, std::string name="T_negative", std::string tag=kElementWise)
 Creates an operation that returns the negation of a given tensor. More...
 
Tensor tvm::topi::logical_not (const Tensor &x, std::string name="T_logical_not", std::string tag=kElementWise)
 Creates an operation that returns the logical NOT of a given tensor. More...
 
Tensor tvm::topi::bitwise_not (const Tensor &x, std::string name="T_bitwise_not", std::string tag=kElementWise)
 Creates an operation that returns the bitwise NOT of a given tensor. More...
 
Tensor tvm::topi::sign (const Tensor &x, std::string name="T_sign", std::string tag=kElementWise)
 Returns the sign of the tensor. More...
 
Tensor tvm::topi::rsqrt (const Tensor &x, std::string name="tensor", std::string tag=kElementWise)
 Creates an operation that returns rsqrt of a given tensor. More...
 
Tensor tvm::topi::clip (const Tensor &x, const PrimExpr &a_min, const PrimExpr &a_max, std::string name="T_clip", std::string tag=kElementWise)
 Creates an operation that clips each element of a tensor to the interval [a_min, a_max]. More...
 
Tensor tvm::topi::cast (const Tensor &x, DataType type, std::string name="T_cast", std::string tag=kElementWise)
 Cast each element of x to the given type. If expr is scalar and type is a corresponding vector type, a Broadcast is generated, otherwise a Cast is generated. More...
 
Tensor tvm::topi::reinterpret (const Tensor &x, DataType type, std::string name="tensor", std::string tag=kElementWise)
 Reinterpret each element of x to the given type. More...
 
Tensor tvm::topi::elemwise_sum (const Array< Tensor > &xs, std::string name="T_elemwise_sum", std::string tag=kElementWise)
 Creates an operation that sum each element of a tensor. More...
 
Tensor tvm::topi::full (const Array< PrimExpr > &shape, DataType dtype, const PrimExpr fill_value, std::string name="T_full", std::string tag=kElementWise)
 Creates an operation that fill a tensor with fill_value. More...
 
Tensor tvm::topi::full_like (const Tensor &x, const PrimExpr fill_value, std::string name="T_full_like", std::string tag=kElementWise)
 Creates an operation that construct a tensor with same shape as input tensor, then fill a tensor with fill_value. More...
 
Tensor tvm::topi::fast_exp_float32 (const Tensor &_x, std::string name, std::string tag)
 Fast exponential function implementation. More...
 
Tensor tvm::topi::fast_exp (const Tensor &x, std::string name="T_fast_exp", std::string tag=kElementWise)
 Fast exponential function implementation. More...
 
Tensor tvm::topi::fast_erf_float32 (const Tensor &data, std::string name, std::string tag)
 Fast_erf_float expression from Eigen. More...
 
Tensor tvm::topi::fast_erf_float16 (const Tensor &data, std::string name, std::string tag)
 Fast_erf_float expression from Eigen for float16. More...
 
Tensor tvm::topi::fast_erf (const Tensor &x, std::string name="T_fast_erf", std::string tag=kElementWise)
 Fast erf implementation. More...
 

Detailed Description

Elementwise op constructions.

Macro Definition Documentation

◆ TOPI_DECLARE_UNARY_OP

#define TOPI_DECLARE_UNARY_OP (   OpName)
Value:
inline Tensor OpName(const Tensor& x, std::string name = "T_" #OpName, \
std::string tag = kElementWise) { \
return compute( \
x->shape, [&](const Array<Var>& i) { return ::tvm::OpName(x(i)); }, name, tag); \
}
Tensor structure representing a possible input, or intermediate computation result.
Definition: tensor.h:102
Tensor compute(Array< PrimExpr > shape, FCompute fcompute, std::string name="tensor", std::string tag="", Map< String, ObjectRef > attrs={})
Construct a new tensor by computing over shape, using the computation rule: result_tensor[axis] = fco...
constexpr auto kElementWise
Definition: tags.h:32