#include <expr.h>
|
| Function (Array< Var > params, Expr body, Optional< StructInfo > ret_struct_info, bool is_pure=true, DictAttrs attrs=DictAttrs(), Span span=Span()) |
| Construct a Relax Function. More...
|
|
| TVM_DEFINE_OBJECT_REF_METHODS (Function, BaseFunc, FunctionNode) |
|
| TVM_DEFINE_OBJECT_REF_COW_METHOD (FunctionNode) |
|
| TVM_DEFINE_OBJECT_REF_METHODS (BaseFunc, RelayExpr, BaseFuncNode) |
|
| TVM_DEFINE_OBJECT_REF_METHODS (RelayExpr, BaseExpr, RelayExprNode) |
|
| TVM_DEFINE_OBJECT_REF_METHODS (BaseExpr, ObjectRef, BaseExprNode) |
|
| ObjectRef ()=default |
| default constructor More...
|
|
| ObjectRef (ObjectPtr< Object > data) |
| Constructor from existing object ptr. More...
|
|
bool | same_as (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | operator== (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | operator!= (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | operator< (const ObjectRef &other) const |
| Comparator. More...
|
|
bool | defined () const |
|
const Object * | get () const |
|
const Object * | operator-> () const |
|
bool | unique () const |
|
int | use_count () const |
|
template<typename ObjectType , typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>> |
const ObjectType * | as () const |
| Try to downcast the internal Object to a raw pointer of a corresponding type. More...
|
|
template<typename ObjectRefType , typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>> |
Optional< ObjectRefType > | as () const |
| Try to downcast the ObjectRef to a Optional<T> of the requested type. More...
|
|
◆ Function()
Construct a Relax Function.
- Parameters
-
params | The parameters accepted by the function |
body | The body of the function. If this is not a SeqExpr, it will be wrapped in a SeqExpr, to satisfy the Relax IR requirement that all scopes be contained in a SeqExpr. |
ret_struct_info | The StructInfo returned by the function. If NullOpt, will be inferred from the StructInfo of the function's body. |
is_pure | The purity of the function. |
attrs | Any attributes associated with the function. Defaults to an empty dictionary. |
span | The source span of the expression. |
◆ CreateEmpty()
Mimics the constructor but without body Expr.
- Note
- ret_struct_info is required, since it can not deduced by the body.
◆ TVM_DEFINE_OBJECT_REF_COW_METHOD()
tvm::relax::Function::TVM_DEFINE_OBJECT_REF_COW_METHOD |
( |
FunctionNode |
| ) |
|
◆ TVM_DEFINE_OBJECT_REF_METHODS()
The documentation for this class was generated from the following file: