24 #ifndef TVM_RELAY_FUNCTION_H_ 25 #define TVM_RELAY_FUNCTION_H_ 62 v->Visit(
"params", ¶ms);
63 v->Visit(
"body", &body);
64 v->Visit(
"ret_type", &ret_type);
65 v->Visit(
"type_params", &type_params);
66 v->Visit(
"attrs", &
attrs);
68 v->Visit(
"span", &
span);
83 hash_reduce.
DefHash(type_params);
84 hash_reduce(ret_type);
97 static constexpr
const char*
_type_key =
"relay.Function";
203 #endif // TVM_RELAY_FUNCTION_H_ tvm::Span Span
Definition: base.h:65
FuncType func_type_annotation() const
Return the derived function annotation of this expression.
DictAttrs attrs
Additional attributes storing the meta-data.
Definition: function.h:80
bool DefEqual(const ObjectRef &lhs, const ObjectRef &rhs)
Reduce condition to comparison of two definitions, where free vars can be mapped. ...
static constexpr const char * _type_key
Definition: function.h:97
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
Managed reference to FunctionNode.
Definition: function.h:105
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:124
constexpr const char * kParams
Store a Var to parameter/Constant mapping on a Function.
Definition: function.h:187
Relay expression language.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:110
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
void VisitAttrs(tvm::AttrVisitor *v)
Definition: function.h:61
Managed reference to DictAttrsNode.
Definition: attrs.h:227
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_DECLARE_FINAL_OBJECT_INFO(FunctionNode, BaseFuncNode)
virtual void MarkGraphNode()=0
Mark current comparison as graph node equal comparison.
constexpr const char * kSkipOptimization
Mark if the function should be avoided being optimized.
Definition: function.h:189
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
Definition: source_map.h:120
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:55
virtual void MarkGraphNode()=0
Mark current comparison as graph node in hashing. Graph node hash will depends on the graph structure...
Type checked_type_
Stores the result of type inference(type checking).
Definition: expr.h:369
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Relay Function container.
Definition: function.h:39
constexpr const char * kPartitionedFromPattern
Indicate the function was created by the Pattern Partitioning Pass.
Definition: function.h:195
ObjectRef virtual_device_
The virtual device (VirtualDevice) for this node (the result of device planning). For first-order exp...
Definition: expr.h:409
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
Managed reference to RelayExprNode.
Definition: expr.h:433
#define TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:713
tvm::Array< Var > params
Function parameters.
Definition: function.h:42
constexpr const char * kReshapeOnly
Mark the function as only composed of reshape operations.
Definition: function.h:197
#define TVM_DEFINE_OBJECT_REF_COW_METHOD(ObjectName)
Define CopyOnWrite function in an ObjectRef.
Definition: object.h:785
Managed reference to FuncTypeNode.
Definition: type.h:480
constexpr const char * kComposite
Treat the function as a composite operator.
Definition: function.h:191
constexpr const char * kInline
Mark the function to be inlined.
Definition: function.h:193
Base node of all functions.
Definition: function.h:77
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
Managed reference to BaseFuncNode.
Definition: function.h:143
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
Managed reference to TypeNode.
Definition: type.h:93
constexpr const char * kClosure
Indicate if the function is a closure.
Definition: function.h:185
tvm::Array< TypeVar > type_params
Type parameters of the function. Enables the function to vary its type based on these. This corresponds to template paramaters in c++'s terminology.
Definition: function.h:59
void SHashReduce(SHashReducer hash_reduce) const
Definition: function.h:80
Expr body
The expression which represents the computation of the function, the expression may reference the par...
Definition: function.h:49
bool SEqualReduce(const FunctionNode *other, SEqualReducer equal) const
Definition: function.h:72
Type ret_type
User annotated return type of the function.
Definition: function.h:51
const FunctionNode * AsOptimizableFunctionNode(const BaseFunc &base_func)
void DefHash(const ObjectRef &key) const
Push hash of key to the current sequence of hash values.
Definition: structural_hash.h:187