34 #ifndef TVM_RELAY_INTERPRETER_H_
35 #define TVM_RELAY_INTERPRETER_H_
43 #include <unordered_set>
66 v->Visit(
"env", &
env);
67 v->Visit(
"func", &
func);
70 static constexpr
const char*
_type_key =
"interpreter.Closure";
91 v->Visit(
"clos", &
clos);
92 v->Visit(
"bind", &
bind);
95 static constexpr
const char*
_type_key =
"interpreter.RecClosure";
112 static constexpr
const char*
_type_key =
"relay.RefValue";
131 v->Visit(
"tag", &
tag);
132 v->Visit(
"fields", &
fields);
136 static constexpr
const char*
_type_key =
"relay.ConstructorValue";
191 std::unordered_set<String> import_set,
Device device,
Target target,
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
Managed reference to ConstructorNode.
Definition: adt.h:88
Managed reference class to IRModuleNode.
Definition: module.h:366
Managed reference to RelayExprNode.
Definition: expr.h:442
Managed reference class to TargetNode.
Definition: target.h:200
Definition: interpreter.h:140
TVM_DEFINE_OBJECT_REF_METHODS(ConstructorValue, ObjectRef, ConstructorValueObj)
ConstructorValue(int32_t tag, tvm::Array< ObjectRef > fields, Constructor construtor={})
Managed reference to FunctionNode.
Definition: function.h:105
The container type of Closures used by the interpreter.
Definition: interpreter.h:49
tvm::Map< Var, ObjectRef > env
The set of free variables in the closure.
Definition: interpreter.h:56
Function func
The function which implements the closure.
Definition: interpreter.h:61
TVM_DECLARE_FINAL_OBJECT_INFO(InterpreterClosureObj, runtime::ClosureObj)
static constexpr const char * _type_key
Definition: interpreter.h:70
void VisitAttrs(tvm::AttrVisitor *v)
Definition: interpreter.h:65
InterpreterClosureObj()
Definition: interpreter.h:63
Definition: interpreter.h:74
TVM_DEFINE_OBJECT_REF_METHODS(InterpreterClosure, runtime::Closure, InterpreterClosureObj)
InterpreterClosure(tvm::Map< Var, ObjectRef > env, Function func)
The container type of RecClosure.
Definition: interpreter.h:81
void VisitAttrs(tvm::AttrVisitor *v)
Definition: interpreter.h:90
TVM_DECLARE_FINAL_OBJECT_INFO(RecClosureObj, Object)
static constexpr const char * _type_key
Definition: interpreter.h:95
InterpreterClosure clos
The closure.
Definition: interpreter.h:84
RecClosureObj()
Definition: interpreter.h:88
Var bind
variable the closure bind to.
Definition: interpreter.h:86
Definition: interpreter.h:99
TVM_DEFINE_OBJECT_REF_METHODS(RecClosure, ObjectRef, RecClosureObj)
RecClosure(InterpreterClosure clos, Var bind)
Definition: interpreter.h:116
TVM_DEFINE_OBJECT_REF_METHODS(RefValue, ObjectRef, RefValueObj)
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
An object representing a closure. This object is used by both the Relay VM and interpreter.
Definition: closure.h:36
reference to closure.
Definition: closure.h:44
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics,...
Definition: map.h:1271
Base class of all object reference.
Definition: object.h:519
base class of all object containers.
Definition: object.h:171
Please refer to TypedPackedFunc<R(Args..)>.
Definition: packed_func.h:63
Runtime Closure container types.
IRModule that holds the functions and type definitions.
TypedPackedFunc< ObjectRef(Array< Expr >)> EvalFunction(IRModule mod, Expr expr, Device device, Target target)
Returns a packed function over Relay expressions which will evaluate expr applied to those arguments,...
ObjectRef Eval(Expr expr, Map< GlobalTypeVar, TypeData > type_definitions, std::unordered_set< String > import_set, Device device, Target target, Map< String, ObjectRef > attrs={})
Evaluates expr and returns its result.
tvm::PrimExpr mod(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:290
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
DLDevice Device
Definition: ndarray.h:43
A managed object in the TVM runtime.
Relay expression language.
Definition: interpreter.h:122
TVM_DECLARE_FINAL_OBJECT_INFO(ConstructorValueObj, Object)
int32_t tag
Definition: interpreter.h:123
static constexpr const char * _type_key
Definition: interpreter.h:136
tvm::Array< ObjectRef > fields
Definition: interpreter.h:125
Constructor constructor
Optional field tracking ADT constructor.
Definition: interpreter.h:128
void VisitAttrs(tvm::AttrVisitor *v)
Definition: interpreter.h:130
Definition: interpreter.h:105
void VisitAttrs(tvm::AttrVisitor *v)
Definition: interpreter.h:110
ObjectRef value
Definition: interpreter.h:106
TVM_DECLARE_FINAL_OBJECT_INFO(RefValueObj, Object)
RefValueObj()
Definition: interpreter.h:108
static constexpr const char * _type_key
Definition: interpreter.h:112
Compilation target object.