tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Typedefs | Functions
tvm::te Namespace Reference

Tensor expression language DSL. More...

Classes

struct  TensorDom
 Temporary data structure to store union of bounds of each axis of Tensor. More...
 
class  OperationNode
 Base class of all operation nodes. More...
 
class  PlaceholderOpNode
 A placeholder op represents an input placeholder. More...
 
class  PlaceholderOp
 Managed reference to PlaceholderOpNode. More...
 
class  BaseComputeOpNode
 A Compute op that compute a tensor on certain domain. This is the base class for ComputeOp (operating on a scalar at a time) More...
 
class  ComputeOpNode
 A Compute op that compute a tensor on certain domain. More...
 
class  ComputeOp
 Managed reference to ComputeOpNode. More...
 
class  ScanOpNode
 Symbolic scan. More...
 
class  ScanOp
 Managed reference to ScanOpNode. More...
 
class  ExternOpNode
 External computation that cannot be splitted. More...
 
class  ExternOp
 Managed reference to ExternOpNode. More...
 
class  Operation
 Operation that produces tensors. More...
 
class  TensorNode
 Node to represent a tensor. More...
 
class  Tensor
 Tensor structure representing a possible input, or intermediate computation result. More...
 

Typedefs

using FCompute = std::function< PrimExpr(const Array< Var > &i)>
 The compute function to specify the input source of a Tensor. More...
 
using FBatchCompute = std::function< Array< PrimExpr >(const Array< Var > &i)>
 The compute function to specify the inputs source of Tensors. More...
 

Functions

Var var (std::string name_hint, DataType t=DataType::Int(32))
 Construct a new Var expression. More...
 
IterVar thread_axis (Range dom, std::string tag)
 Create a new IterVar that represents an axis in thread. More...
 
IterVar reduce_axis (Range dom, std::string name="rv")
 Create a new IterVar for reduction operations. More...
 
Tensor placeholder (Array< PrimExpr > shape, DataType dtype=DataType::Float(32), std::string name="placeholder")
 create a place holder tensor. More...
 
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] = fcompute(axis) More...
 
Array< Tensorcompute (Array< PrimExpr > shape, FBatchCompute 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] = fcompute(axis) More...
 
Array< Tensorscan (Array< Tensor > init, Array< Tensor > update, Array< Tensor > state_placeholder, Array< Tensor > inputs=Array< Tensor >(), std::string name="scan", std::string tag="", Map< String, ObjectRef > attrs={})
 Construct new tensors by scan. More...
 
Tensor compute (Array< PrimExpr > shape, std::function< PrimExpr(Var)> f, std::string name="tensor", std::string tag="", Map< String, ObjectRef > attrs={})
 
Tensor compute (Array< PrimExpr > shape, std::function< PrimExpr(Var, Var)> f, std::string name="tensor", std::string tag="", Map< String, ObjectRef > attrs={})
 
Tensor compute (Array< PrimExpr > shape, std::function< PrimExpr(Var, Var, Var)> f, std::string name="tensor", std::string tag="", Map< String, ObjectRef > attrs={})
 
Tensor compute (Array< PrimExpr > shape, std::function< PrimExpr(Var, Var, Var, Var)> f, std::string name="tensor", std::string tag="", Map< String, ObjectRef > attrs={})
 
PrimExpr operator! (const Tensor::Slice &a)
 
PrimExpr operator- (const Tensor::Slice &a)
 
template<typename T >
PrimExpr operator+ (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator+ (const T &a, const Tensor::Slice &b)
 
PrimExpr operator+ (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator- (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator- (const T &a, const Tensor::Slice &b)
 
PrimExpr operator- (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator* (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator* (const T &a, const Tensor::Slice &b)
 
PrimExpr operator* (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator== (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator== (const T &a, const Tensor::Slice &b)
 
PrimExpr operator== (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator<= (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator<= (const T &a, const Tensor::Slice &b)
 
PrimExpr operator<= (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator>= (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator>= (const T &a, const Tensor::Slice &b)
 
PrimExpr operator>= (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator!= (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator!= (const T &a, const Tensor::Slice &b)
 
PrimExpr operator!= (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator&& (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator&& (const T &a, const Tensor::Slice &b)
 
PrimExpr operator&& (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator|| (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator|| (const T &a, const Tensor::Slice &b)
 
PrimExpr operator|| (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator>> (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator>> (const T &a, const Tensor::Slice &b)
 
PrimExpr operator>> (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator<< (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator<< (const T &a, const Tensor::Slice &b)
 
PrimExpr operator<< (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator> (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator> (const T &a, const Tensor::Slice &b)
 
PrimExpr operator> (const Tensor::Slice &a, const Tensor::Slice &b)
 
template<typename T >
PrimExpr operator< (const Tensor::Slice &a, const T &b)
 
template<typename T >
PrimExpr operator< (const T &a, const Tensor::Slice &b)
 
PrimExpr operator< (const Tensor::Slice &a, const Tensor::Slice &b)
 

Detailed Description

Tensor expression language DSL.

Typedef Documentation

◆ FBatchCompute

using tvm::te::FBatchCompute = typedef std::function<Array<PrimExpr>(const Array<Var>& i)>

The compute function to specify the inputs source of Tensors.

◆ FCompute

using tvm::te::FCompute = typedef std::function<PrimExpr(const Array<Var>& i)>

The compute function to specify the input source of a Tensor.

Function Documentation

◆ compute() [1/6]

Array<Tensor> tvm::te::compute ( Array< PrimExpr shape,
FBatchCompute  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] = fcompute(axis)

Parameters
shapeShape of the tensor.
fcomputeThe compute function to create the tensors.
nameThe optional name of the tensor.
tagThe optional tag of the tensor.
attrsOptional additional attributes of the compute.

◆ compute() [2/6]

Tensor tvm::te::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] = fcompute(axis)

Parameters
shapeShape of the tensor.
fcomputeThe compute function to create the tensor.
nameThe optional name of the tensor.
tagThe optional tag of the tensor.
attrsOptional additional attributes of the compute.

◆ compute() [3/6]

Tensor tvm::te::compute ( Array< PrimExpr shape,
std::function< PrimExpr(Var)>  f,
std::string  name = "tensor",
std::string  tag = "",
Map< String, ObjectRef attrs = {} 
)
inline

◆ compute() [4/6]

Tensor tvm::te::compute ( Array< PrimExpr shape,
std::function< PrimExpr(Var, Var)>  f,
std::string  name = "tensor",
std::string  tag = "",
Map< String, ObjectRef attrs = {} 
)
inline

◆ compute() [5/6]

Tensor tvm::te::compute ( Array< PrimExpr shape,
std::function< PrimExpr(Var, Var, Var)>  f,
std::string  name = "tensor",
std::string  tag = "",
Map< String, ObjectRef attrs = {} 
)
inline

◆ compute() [6/6]

Tensor tvm::te::compute ( Array< PrimExpr shape,
std::function< PrimExpr(Var, Var, Var, Var)>  f,
std::string  name = "tensor",
std::string  tag = "",
Map< String, ObjectRef attrs = {} 
)
inline

◆ operator!()

PrimExpr tvm::te::operator! ( const Tensor::Slice a)
inline

◆ operator!=() [1/3]

template<typename T >
PrimExpr tvm::te::operator!= ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator!=() [2/3]

template<typename T >
PrimExpr tvm::te::operator!= ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator!=() [3/3]

PrimExpr tvm::te::operator!= ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator&&() [1/3]

template<typename T >
PrimExpr tvm::te::operator&& ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator&&() [2/3]

template<typename T >
PrimExpr tvm::te::operator&& ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator&&() [3/3]

PrimExpr tvm::te::operator&& ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator*() [1/3]

template<typename T >
PrimExpr tvm::te::operator* ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator*() [2/3]

template<typename T >
PrimExpr tvm::te::operator* ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator*() [3/3]

PrimExpr tvm::te::operator* ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator+() [1/3]

template<typename T >
PrimExpr tvm::te::operator+ ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator+() [2/3]

template<typename T >
PrimExpr tvm::te::operator+ ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator+() [3/3]

PrimExpr tvm::te::operator+ ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator-() [1/4]

template<typename T >
PrimExpr tvm::te::operator- ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator-() [2/4]

PrimExpr tvm::te::operator- ( const Tensor::Slice a)
inline

◆ operator-() [3/4]

template<typename T >
PrimExpr tvm::te::operator- ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator-() [4/4]

PrimExpr tvm::te::operator- ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator<() [1/3]

template<typename T >
PrimExpr tvm::te::operator< ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator<() [2/3]

template<typename T >
PrimExpr tvm::te::operator< ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator<() [3/3]

PrimExpr tvm::te::operator< ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator<<() [1/3]

template<typename T >
PrimExpr tvm::te::operator<< ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator<<() [2/3]

template<typename T >
PrimExpr tvm::te::operator<< ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator<<() [3/3]

PrimExpr tvm::te::operator<< ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator<=() [1/3]

template<typename T >
PrimExpr tvm::te::operator<= ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator<=() [2/3]

template<typename T >
PrimExpr tvm::te::operator<= ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator<=() [3/3]

PrimExpr tvm::te::operator<= ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator==() [1/3]

template<typename T >
PrimExpr tvm::te::operator== ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator==() [2/3]

template<typename T >
PrimExpr tvm::te::operator== ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator==() [3/3]

PrimExpr tvm::te::operator== ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator>() [1/3]

template<typename T >
PrimExpr tvm::te::operator> ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator>() [2/3]

template<typename T >
PrimExpr tvm::te::operator> ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator>() [3/3]

PrimExpr tvm::te::operator> ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator>=() [1/3]

template<typename T >
PrimExpr tvm::te::operator>= ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator>=() [2/3]

template<typename T >
PrimExpr tvm::te::operator>= ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator>=() [3/3]

PrimExpr tvm::te::operator>= ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator>>() [1/3]

template<typename T >
PrimExpr tvm::te::operator>> ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator>>() [2/3]

template<typename T >
PrimExpr tvm::te::operator>> ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator>>() [3/3]

PrimExpr tvm::te::operator>> ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ operator||() [1/3]

template<typename T >
PrimExpr tvm::te::operator|| ( const T &  a,
const Tensor::Slice b 
)
inline

◆ operator||() [2/3]

template<typename T >
PrimExpr tvm::te::operator|| ( const Tensor::Slice a,
const T &  b 
)
inline

◆ operator||() [3/3]

PrimExpr tvm::te::operator|| ( const Tensor::Slice a,
const Tensor::Slice b 
)
inline

◆ placeholder()

Tensor tvm::te::placeholder ( Array< PrimExpr shape,
DataType  dtype = DataType::Float(32),
std::string  name = "placeholder" 
)

create a place holder tensor.

Parameters
shapeThe shape of the tensor.
dtypethe data type of the tensor.
nameThe name of the Tensor.

◆ reduce_axis()

IterVar tvm::te::reduce_axis ( Range  dom,
std::string  name = "rv" 
)

Create a new IterVar for reduction operations.

Parameters
domThe domain of the reduction axis.
nameThe name of the reduction axis.

◆ scan()

Array<Tensor> tvm::te::scan ( Array< Tensor init,
Array< Tensor update,
Array< Tensor state_placeholder,
Array< Tensor inputs = ArrayTensor >(),
std::string  name = "scan",
std::string  tag = "",
Map< String, ObjectRef attrs = {} 
)

Construct new tensors by scan.

Parameters
initThe intialize tensor of first K steps.
updateThe update tensor indicated the updated result after each timestamp.
state_placeholderThe placeholder for the states.
inputsThe inputs to the scan body, this is optional, but recommended to provide concrete information about scan body.
nameThe optional name of the tensor.
tagThe optional tag of the tensor.
attrsOptional additional attributes of the compute.

◆ thread_axis()

IterVar tvm::te::thread_axis ( Range  dom,
std::string  tag 
)

Create a new IterVar that represents an axis in thread.

Parameters
domOptional, domain of the thread axis.
tagThe thread tag of the axis.

◆ var()

Var tvm::te::var ( std::string  name_hint,
DataType  t = DataType::Int(32) 
)

Construct a new Var expression.

Parameters
name_hintThe name hint for the expression
tThe type of the expression