19 #ifndef TVM_SCRIPT_PRINTER_FRAME_H_ 20 #define TVM_SCRIPT_PRINTER_FRAME_H_ 46 template <
typename TCallback>
48 callbacks_.emplace_back(std::forward<TCallback>(cb));
60 for (
const std::function<
void()>& callback : callbacks_) {
66 static constexpr
const char*
_type_key =
"script.printer.Frame";
70 std::vector<std::function<void()>> callbacks_;
81 virtual ~
Frame() =
default;
94 v->Visit(
"metadata", &metadata);
97 static constexpr
const char*
_type_key =
"script.printer.MetadataFrame";
120 v->Visit(
"stmts", &stmts);
123 static constexpr
const char*
_type_key =
"script.printer.VarDefFrame";
140 #endif // TVM_SCRIPT_PRINTER_FRAME_H_
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:38
virtual ~FrameNode()=default
#define TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:758
Definitions and helper macros for IR/AST nodes.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
base class of all object containers.
Definition: object.h:167
VarDefFrame contains information about the free variables that needs to be defined at the beginning o...
Definition: frame.h:114
Array< StmtDoc > stmts
Definition: frame.h:116
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
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Reference type of FrameNode.
Definition: frame.h:76
static constexpr const char * _type_key
Definition: frame.h:66
Reference type of VarDefFrameNode.
Definition: frame.h:130
Base class of all object reference.
Definition: object.h:511
virtual void ExitWithScope()
Method that's called when Frame exits the scope.
Definition: frame.h:59
#define TVM_DECLARE_FINAL_OBJECT_INFO(TypeName, ParentType)
helper macro to declare type information in a final class.
Definition: object.h:671
TVM_DECLARE_BASE_OBJECT_INFO(FrameNode, Object)
void AddExitCallback(TCallback &&cb)
Add a callback function to be called when this frame exits.
Definition: frame.h:47
virtual void EnterWithScope()
Method that's called when Frame enters the scope.
Definition: frame.h:54
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:118