24 #ifndef TVM_RELAY_FUNCTION_H_
25 #define TVM_RELAY_FUNCTION_H_
62 v->Visit(
"params", &
params);
63 v->Visit(
"body", &
body);
66 v->Visit(
"attrs", &
attrs);
68 v->Visit(
"span", &
span);
74 equal->MarkGraphNode();
97 static constexpr
const char*
_type_key =
"relay.Function";
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:56
Base node of all functions.
Definition: function.h:139
DictAttrs attrs
Additional attributes storing the meta-data.
Definition: function.h:142
Managed reference to BaseFuncNode.
Definition: function.h:230
Managed reference to DictAttrsNode.
Definition: attrs.h:227
Managed reference to FuncTypeNode.
Definition: type.h:481
ObjectRef virtual_device_
The virtual device (VirtualDevice) for this node (the result of device planning). For first-order exp...
Definition: expr.h:418
Type checked_type_
Stores the result of type inference(type checking).
Definition: expr.h:370
Managed reference to RelayExprNode.
Definition: expr.h:442
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:137
virtual void MarkGraphNode()=0
Mark current comparison as graph node in hashing. Graph node hash will depends on the graph structure...
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:121
void DefHash(const ObjectRef &key) const
Push hash of key to the current sequence of hash values.
Definition: structural_hash.h:198
Definition: source_map.h:120
Managed reference to TypeNode.
Definition: type.h:93
Relay Function container.
Definition: function.h:39
Type ret_type
User annotated return type of the function.
Definition: function.h:51
TVM_DECLARE_FINAL_OBJECT_INFO(FunctionNode, BaseFuncNode)
Expr body
The expression which represents the computation of the function, the expression may reference the par...
Definition: function.h:49
tvm::Array< TypeVar > type_params
Type parameters of the function. Enables the function to vary its type based on these....
Definition: function.h:59
bool SEqualReduce(const FunctionNode *other, SEqualReducer equal) const
Definition: function.h:72
tvm::Array< Var > params
Function parameters.
Definition: function.h:42
static constexpr const char * _type_key
Definition: function.h:97
void VisitAttrs(tvm::AttrVisitor *v)
Definition: function.h:61
FuncType func_type_annotation() const
Return the derived function annotation of this expression.
void SHashReduce(SHashReducer hash_reduce) const
Definition: function.h:80
Managed reference to FunctionNode.
Definition: function.h:105
TVM_DEFINE_OBJECT_REF_COW_METHOD(FunctionNode)
Function(tvm::Array< Var > params, Expr body, Type ret_type, tvm::Array< TypeVar > ty_params, tvm::DictAttrs attrs=DictAttrs(), Span span=Span())
Constructor.
TVM_DEFINE_OBJECT_REF_METHODS(Function, BaseFunc, FunctionNode)
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
constexpr const char * kComposite
Treat the function as a composite operator.
Definition: function.h:191
constexpr const char * kCompiler
Indicates the name of the external codegen 'compiler' that should be used to lower or compile the fun...
Definition: function.h:182
constexpr const char * kParams
Store a Var to parameter/Constant mapping on a Function.
Definition: function.h:187
constexpr const char * kExtern
Mark the function as externally implemented, ie bound in a runtime::Module within the IRModule's "ext...
Definition: function.h:173
constexpr const char * kReshapeOnly
Mark the function as only composed of reshape operations.
Definition: function.h:197
constexpr const char * kPrimitive
Mark the function as representing a sub-graph which is to be lowered or compiled as a unit....
Definition: function.h:164
constexpr const char * kInline
Mark the function to be inlined.
Definition: function.h:193
constexpr const char * kSkipOptimization
Mark if the function should be avoided being optimized.
Definition: function.h:189
constexpr const char * kClosure
Indicate if the function is a closure.
Definition: function.h:185
constexpr const char * kPartitionedFromPattern
Indicate the function was created by the Pattern Partitioning Pass.
Definition: function.h:195
const FunctionNode * AsOptimizableFunctionNode(const BaseFunc &base_func)
Clause WithFields(Clause clause, Optional< Pattern > opt_lhs=Optional< Pattern >(), Optional< Expr > opt_rhs=Optional< Expr >())
Returns clause with the given properties. A null property denotes 'no change'. Returns clause if all ...
tvm::Span Span
Definition: base.h:65
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
Relay expression language.