tvm
expr.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
24 #ifndef TVM_RELAY_EXPR_H_
25 #define TVM_RELAY_EXPR_H_
26 
27 #include <tvm/ir/attrs.h>
28 #include <tvm/ir/expr.h>
29 #include <tvm/ir/module.h>
30 #include <tvm/ir/op.h>
32 
33 #include <functional>
34 #include <stack>
35 #include <string>
36 #include <utility>
37 
38 #include "./base.h"
39 #include "./type.h"
40 
41 namespace tvm {
42 
48 GlobalVar WithFields(GlobalVar global_var, Optional<String> opt_name_hint = {},
49  Optional<Type> opt_type = {}, Optional<VirtualDevice> opt_virtual_device = {},
50  Optional<Span> opt_span = {});
51 
52 namespace relay {
53 
60 using tvm::PrettyPrint;
61 
68 class Constant;
72 class ConstantNode : public ExprNode {
73  public:
76 
78  TensorType tensor_type() const;
79 
81  bool is_scalar() const { return data->ndim == 0; }
82 
84  v->Visit("data", &data);
85  v->Visit("virtual_device_", &virtual_device_);
86  v->Visit("span", &span);
87  v->Visit("_checked_type_", &checked_type_);
88  }
89 
90  bool SEqualReduce(const ConstantNode* other, SEqualReducer equal) const {
91  return equal(data, other->data);
92  }
93 
94  void SHashReduce(SHashReducer hash_reduce) const { hash_reduce(data); }
95 
96  static constexpr const char* _type_key = "relay.Constant";
98 };
99 
100 class Constant : public Expr {
101  public:
107  TVM_DLL explicit Constant(runtime::NDArray data, Span span = Span());
108 
111 };
112 
119  Optional<VirtualDevice> opt_virtual_device = {}, Optional<Span> opt_span = {});
120 
122 class Tuple;
124 class TupleNode : public ExprNode {
125  public:
128 
130  v->Visit("fields", &fields);
131  v->Visit("virtual_device_", &virtual_device_);
132  v->Visit("span", &span);
133  v->Visit("_checked_type_", &checked_type_);
134  }
135 
136  bool SEqualReduce(const TupleNode* other, SEqualReducer equal) const {
137  // specially handle empty tuple as a constant is not a graph node.
138  if (fields.size() == other->fields.size() && fields.size() == 0) {
139  return true;
140  } else {
141  equal->MarkGraphNode();
142  return equal(fields, other->fields);
143  }
144  }
145 
146  void SHashReduce(SHashReducer hash_reduce) const {
147  if (fields.size() != 0) {
148  hash_reduce->MarkGraphNode();
149  hash_reduce(fields);
150  }
151  }
152 
153  static constexpr const char* _type_key = "relay.Tuple";
155 };
156 
157 class Tuple : public Expr {
158  public:
164  TVM_DLL explicit Tuple(tvm::Array<relay::Expr> fields, Span span = Span());
165 
168 };
169 
176  Optional<VirtualDevice> opt_virtual_device = Optional<VirtualDevice>(),
177  Optional<Span> opt_span = Optional<Span>());
178 
187 class Var;
189 class VarNode : public ExprNode {
190  public:
207 
209  const String& name_hint() const { return vid->name_hint; }
210 
212  v->Visit("vid", &vid);
213  v->Visit("type_annotation", &type_annotation);
214  v->Visit("virtual_device_", &virtual_device_);
215  v->Visit("span", &span);
216  v->Visit("_checked_type_", &checked_type_);
217  }
218 
219  bool SEqualReduce(const VarNode* other, SEqualReducer equal) const {
220  equal->MarkGraphNode();
221  return equal(type_annotation, other->type_annotation) && equal(vid, other->vid) &&
223  }
224 
225  void SHashReduce(SHashReducer hash_reduce) const {
226  hash_reduce->MarkGraphNode();
227  hash_reduce(type_annotation);
228  hash_reduce(vid);
229  }
230 
231  static constexpr const char* _type_key = "relay.Var";
233 };
234 
235 class Var : public Expr {
236  public:
243  TVM_DLL Var(String name_hint, Type type_annotation, Span span = Span())
244  : Var(Id(name_hint), type_annotation, span) {}
245 
252  TVM_DLL Var(Id vid, Type type_annotation, Span span = Span());
253 
261  static Var GenSym(Type type_annotation = {}, Span span = {});
262 
265 };
266 
273  Optional<Type> opt_type_annotation = Optional<Type>(),
274  Optional<VirtualDevice> opt_virtual_device = Optional<VirtualDevice>(),
275  Optional<Span> opt_span = Optional<Span>());
276 
281 class Call;
283 class CallNode : public ExprNode {
284  protected:
285  // CallNode uses own deleter to indirectly call non-recursive destructor
287  static void Deleter_(Object* ptr);
288 
289  public:
297 
300 
303 
323 
325  v->Visit("op", &op);
326  v->Visit("args", &args);
327  v->Visit("attrs", &attrs);
328  v->Visit("type_args", &type_args);
329  v->Visit("virtual_device_", &virtual_device_);
330  v->Visit("span", &span);
331  v->Visit("_checked_type_", &checked_type_);
332  }
333 
334  bool SEqualReduce(const CallNode* other, SEqualReducer equal) const {
335  // skip type_args check for primitive ops.
336  equal->MarkGraphNode();
337  return equal(op, other->op) && equal(args, other->args) && equal(attrs, other->attrs) &&
338  (IsPrimitiveOp(op) || equal(type_args, other->type_args));
339  }
340 
341  void SHashReduce(SHashReducer hash_reduce) const {
342  hash_reduce->MarkGraphNode();
343  hash_reduce(op);
344  hash_reduce(args);
345  hash_reduce(attrs);
346  if (!IsPrimitiveOp(op)) {
347  hash_reduce(type_args);
348  }
349  }
350 
351  static constexpr const char* _type_key = "relay.Call";
353  template <typename>
355  friend class Call;
356 };
357 
358 class Call : public Expr {
359  public:
363  ~Call();
364 
373  TVM_DLL Call(Expr op, Array<Expr> args, Attrs attrs = Attrs(),
374  Array<Type> type_args = Array<Type>(), Span span = Span());
375 
378 };
379 
386  Optional<Array<Expr>> opt_args = Optional<Array<Expr>>(),
387  Optional<Attrs> opt_attrs = Optional<Attrs>(),
388  Optional<Array<Type>> opt_type_args = Optional<Array<Type>>(),
389  Optional<VirtualDevice> opt_virtual_device = Optional<VirtualDevice>(),
390  Optional<Span> opt_span = Optional<Span>());
391 
403 class Let;
405 class LetNode : public ExprNode {
406  protected:
407  // LetNode uses own deleter to indirectly call non-recursive destructor
409  static void Deleter_(Object* ptr);
410 
411  public:
418 
420  v->Visit("var", &var);
421  v->Visit("value", &value);
422  v->Visit("body", &body);
423  v->Visit("virtual_device_", &virtual_device_);
424  v->Visit("span", &span);
425  v->Visit("_checked_type_", &checked_type_);
426  }
427 
428  bool SEqualReduce(const LetNode* other, SEqualReducer equal) const {
429  equal->MarkGraphNode();
430  return equal.DefEqual(var, other->var) && equal(value, other->value) &&
431  equal(body, other->body);
432  }
433 
434  void SHashReduce(SHashReducer hash_reduce) const {
435  hash_reduce->MarkGraphNode();
436  hash_reduce.DefHash(var);
437  hash_reduce(value);
438  hash_reduce(body);
439  }
440 
441  static constexpr const char* _type_key = "relay.Let";
443  template <typename>
445  friend class Let;
446 };
447 
448 class Let : public Expr {
449  public:
453  ~Let();
454 
462  TVM_DLL Let(Var var, Expr value, Expr body, Span span = Span());
463 
466 };
467 
473 Let WithFields(Let let, Optional<Var> opt_var = Optional<Var>(),
474  Optional<Expr> opt_value = Optional<Expr>(),
475  Optional<Expr> opt_body = Optional<Expr>(),
476  Optional<VirtualDevice> opt_virtual_device = Optional<VirtualDevice>(),
477  Optional<Span> opt_span = Optional<Span>());
478 
490 class If;
492 class IfNode : public ExprNode {
493  public:
500 
502  v->Visit("cond", &cond);
503  v->Visit("true_branch", &true_branch);
504  v->Visit("false_branch", &false_branch);
505  v->Visit("virtual_device_", &virtual_device_);
506  v->Visit("span", &span);
507  v->Visit("_checked_type_", &checked_type_);
508  }
509 
510  bool SEqualReduce(const IfNode* other, SEqualReducer equal) const {
511  equal->MarkGraphNode();
512  return equal(cond, other->cond) && equal(true_branch, other->true_branch) &&
513  equal(false_branch, other->false_branch);
514  }
515 
516  void SHashReduce(SHashReducer hash_reduce) const {
517  hash_reduce->MarkGraphNode();
518  hash_reduce(cond);
519  hash_reduce(true_branch);
520  hash_reduce(false_branch);
521  }
522 
523  static constexpr const char* _type_key = "relay.If";
525 };
526 
527 class If : public Expr {
528  public:
536  TVM_DLL If(Expr cond, Expr true_branch, Expr false_branch, Span span = Span());
537 
540 };
541 
547 If WithFields(If if_expr, Optional<Expr> opt_cond = Optional<Expr>(),
548  Optional<Expr> opt_true_branch = Optional<Expr>(),
549  Optional<Expr> opt_false_branch = Optional<Expr>(),
550  Optional<VirtualDevice> opt_virtual_device = Optional<VirtualDevice>(),
551  Optional<Span> opt_span = Optional<Span>());
552 
554 class TupleGetItem;
555 class TupleGetItemNode : public ExprNode {
556  public:
560  int index;
561 
563  v->Visit("tuple_value", &tuple);
564  v->Visit("index", &index);
565  v->Visit("virtual_device_", &virtual_device_);
566  v->Visit("span", &span);
567  v->Visit("_checked_type_", &checked_type_);
568  }
569 
570  bool SEqualReduce(const TupleGetItemNode* other, SEqualReducer equal) const {
571  return equal(tuple, other->tuple) && equal(index, other->index);
572  }
573 
574  void SHashReduce(SHashReducer hash_reduce) const {
575  hash_reduce(tuple);
576  hash_reduce(index);
577  }
578 
579  static constexpr const char* _type_key = "relay.TupleGetItem";
581 };
582 
583 class TupleGetItem : public Expr {
584  public:
591  TVM_DLL TupleGetItem(Expr tuple, int index, Span span = Span());
592 
595 };
596 
603  Optional<Integer> opt_index = Optional<Integer>(),
604  Optional<VirtualDevice> opt_virtual_device = Optional<VirtualDevice>(),
605  Optional<Span> opt_span = Optional<Span>());
606 
608 class RefCreate;
609 class RefCreateNode : public ExprNode {
610  public:
613 
615  v->Visit("value", &value);
616  v->Visit("virtual_device_", &virtual_device_);
617  v->Visit("span", &span);
618  v->Visit("_checked_type_", &checked_type_);
619  }
620 
621  bool SEqualReduce(const RefCreateNode* other, SEqualReducer equal) const {
622  equal->MarkGraphNode();
623  return equal(value, other->value);
624  }
625 
626  void SHashReduce(SHashReducer hash_reduce) const {
627  hash_reduce->MarkGraphNode();
628  hash_reduce(value);
629  }
630 
631  static constexpr const char* _type_key = "relay.RefCreate";
633 };
634 
635 class RefCreate : public Expr {
636  public:
642  TVM_DLL explicit RefCreate(Expr value, Span span = Span());
643 
646 };
647 
654  Optional<VirtualDevice> opt_virtual_device = Optional<VirtualDevice>(),
655  Optional<Span> opt_span = Optional<Span>());
656 
658 class RefRead;
659 class RefReadNode : public ExprNode {
660  public:
663 
665  v->Visit("ref", &ref);
666  v->Visit("virtual_device_", &virtual_device_);
667  v->Visit("span", &span);
668  v->Visit("_checked_type_", &checked_type_);
669  }
670 
671  bool SEqualReduce(const RefReadNode* other, SEqualReducer equal) const {
672  equal->MarkGraphNode();
673  return equal(ref, other->ref);
674  }
675 
676  void SHashReduce(SHashReducer hash_reduce) const {
677  hash_reduce->MarkGraphNode();
678  hash_reduce(ref);
679  }
680 
681  static constexpr const char* _type_key = "relay.RefRead";
683 };
684 
685 class RefRead : public Expr {
686  public:
692  TVM_DLL explicit RefRead(Expr ref, Span span = Span());
693 
696 };
697 
704  Optional<VirtualDevice> opt_virtual_device = Optional<VirtualDevice>(),
705  Optional<Span> opt_span = Optional<Span>());
706 
708 class RefWrite;
709 class RefWriteNode : public ExprNode {
710  public:
715 
717  v->Visit("ref", &ref);
718  v->Visit("value", &value);
719  v->Visit("virtual_device_", &virtual_device_);
720  v->Visit("span", &span);
721  v->Visit("_checked_type_", &checked_type_);
722  }
723 
724  bool SEqualReduce(const RefWriteNode* other, SEqualReducer equal) const {
725  equal->MarkGraphNode();
726  return equal(ref, other->ref) && equal(value, other->value);
727  }
728 
729  void SHashReduce(SHashReducer hash_reduce) const {
730  hash_reduce->MarkGraphNode();
731  hash_reduce(ref);
732  hash_reduce(value);
733  }
734 
735  static constexpr const char* _type_key = "relay.RefWrite";
737 };
738 
739 class RefWrite : public Expr {
740  public:
747  TVM_DLL RefWrite(Expr ref, Expr value, Span span = Span());
748 
751 };
752 
759  Optional<Expr> opt_value = Optional<Expr>(),
760  Optional<VirtualDevice> opt_virtual_device = Optional<VirtualDevice>(),
761  Optional<Span> opt_span = Optional<Span>());
762 
775 class TempExprNode : public ExprNode {
776  public:
778  virtual ~TempExprNode() {}
783  virtual Expr Realize() const = 0;
784 
785  static constexpr const char* _type_key = "relay.TempExpr";
786  static constexpr const bool _type_has_method_sequal_reduce = false;
787  static constexpr const bool _type_has_method_shash_reduce = false;
788  static constexpr const uint32_t _type_child_slots = 0;
790 };
791 
792 class TempExpr : public Expr {
793  public:
795 };
796 
797 } // namespace relay
798 
799 namespace runtime {
800 
801 template <>
802 template <>
805  using Derived = SimpleObjAllocator;
806  using T = relay::LetNode;
807  using Handler = typename Derived::template Handler<T>;
808  static_assert(std::is_base_of<Object, T>::value, "make can only be used to create Object");
809  T* ptr = Handler::New(static_cast<Derived*>(this));
810  ptr->type_index_ = T::RuntimeTypeIndex();
811  ptr->saved_deleter_ = Handler::Deleter();
812  ptr->deleter_ = relay::LetNode::Deleter_;
813  return ObjectPtr<T>(ptr);
814 }
815 
816 template <>
817 template <>
820  using Derived = SimpleObjAllocator;
821  using T = relay::CallNode;
822  using Handler = typename Derived::template Handler<T>;
823  static_assert(std::is_base_of<Object, T>::value, "make can only be used to create Object");
824  T* ptr = Handler::New(static_cast<Derived*>(this));
825  ptr->type_index_ = T::RuntimeTypeIndex();
826  ptr->saved_deleter_ = Handler::Deleter();
827  ptr->deleter_ = relay::CallNode::Deleter_;
828  return ObjectPtr<T>(ptr);
829 }
830 
831 } // namespace runtime
832 
833 } // namespace tvm
834 #endif // TVM_RELAY_EXPR_H_
tvm::Span Span
Definition: base.h:65
Definition: expr.h:739
Expr true_branch
The expression evaluated when condition is true.
Definition: expr.h:497
Definition: expr.h:157
bool SEqualReduce(const LetNode *other, SEqualReducer equal) const
Definition: expr.h:428
bool DefEqual(const ObjectRef &lhs, const ObjectRef &rhs)
Reduce condition to comparison of two definitions, where free vars can be mapped. ...
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:626
tvm::Array< relay::Expr > args
The arguments(inputs) of the call.
Definition: expr.h:299
tvm::BaseFuncNode BaseFuncNode
Definition: expr.h:57
A custom smart pointer for Object.
Definition: object.h:358
Attrs attrs
The additional attributes.
Definition: expr.h:302
RealizeFrame Realize(tvm::tir::BufferRegion buffer_slice, String storage_scope, PrimExpr condition)
The realization.
Base class of the temporary expression.
Definition: expr.h:775
bool SEqualReduce(const VarNode *other, SEqualReducer equal) const
Definition: expr.h:219
bool SEqualReduce(const TupleNode *other, SEqualReducer equal) const
Definition: expr.h:136
Managed reference to TensorTypeNode.
Definition: tensor_type.h:99
Definition: expr.h:792
Call container.
Definition: expr.h:283
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:124
Managed reference to BaseAttrsNode.
Definition: attrs.h:190
Base expr nodes in TVM.
A compile time representation for where data is to be stored at runtime, and how to compile code to c...
static constexpr const bool _type_has_method_shash_reduce
Definition: expr.h:59
IRModule that holds the functions and type definitions.
Var(String name_hint, Type type_annotation, Span span=Span())
The constructor.
Definition: expr.h:243
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Definition: expr.h:609
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:102
Object::FDeleter saved_deleter_
Definition: expr.h:408
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:94
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:211
tvm::Array< relay::Expr > fields
the fields of the tuple
Definition: expr.h:127
Definition: expr.h:709
static void Deleter_(Object *ptr)
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
Constant tensor type.
Definition: expr.h:72
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:516
bool is_scalar() const
Definition: expr.h:81
Expr cond
The condition.
Definition: expr.h:495
Definition: expr.h:685
bool SEqualReduce(const RefWriteNode *other, SEqualReducer equal) const
Definition: expr.h:724
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:716
Definition: expr.h:100
Type type_annotation
type annotaion of the variable. This field records user provided type annotation of the Var...
Definition: expr.h:206
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:562
Definition: expr.h:358
static constexpr const char * _type_key
Definition: expr.h:96
tvm::BaseFunc BaseFunc
Definition: expr.h:56
Expr body
The body of the let binding.
Definition: expr.h:417
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 &#39;no change&#39;. Returns clause if all ...
base class of all object containers.
Definition: object.h:167
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:614
Managed NDArray. The array is backed by reference counted blocks.
Definition: ndarray.h:59
Container for Var.
Definition: expr.h:189
tvm::Array< Type > type_args
The type arguments passed to polymorphic(template) function.
Definition: expr.h:322
Expr ref
The Reference Expression.
Definition: expr.h:662
Helpers for attribute objects.
virtual void MarkGraphNode()=0
Mark current comparison as graph node equal comparison.
Expr tuple
The tuple Expression.
Definition: expr.h:558
Primitive operators(builtin intrinsics) and registry for them.
Expr op
The operator(function) being invoked.
Definition: expr.h:296
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:341
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
bool SEqualReduce(const IfNode *other, SEqualReducer equal) const
Definition: expr.h:510
Definition: span.h:115
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:225
tvm::GlobalVarNode GlobalVarNode
Definition: expr.h:59
A binding of a sub-network.
Definition: expr.h:405
size_t size() const
Definition: array.h:418
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:55
Var var
The variable we bind to.
Definition: expr.h:413
Definition: expr.h:635
tvm::GlobalVar GlobalVar
Definition: expr.h:58
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:367
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:729
static constexpr const bool _type_has_method_sequal_reduce
Definition: expr.h:58
bool IsPrimitiveOp(const RelayExpr &expr)
Check that an expression is a "primitive operator".
Definition: op.h:509
Definition: base.h:112
Relay typed AST nodes.
void(* FDeleter)(Object *self)
Object deleter.
Definition: object.h:173
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:324
Managed reference to GlobalVarNode.
Definition: expr.h:475
Expr false_branch
The expression evaluated when condition is false.
Definition: expr.h:499
Tuple container.
Definition: expr.h:124
bool SEqualReduce(const ConstantNode *other, SEqualReducer equal) const
Definition: expr.h:90
ObjectRef virtual_device_
The virtual device (VirtualDevice) for this node (the result of device planning). For first-order exp...
Definition: expr.h:407
TVM_DECLARE_FINAL_OBJECT_INFO(ConstantNode, ExprNode)
Reference to string objects.
Definition: string.h:97
LetFrame Let(Var var, PrimExpr value)
The let binding.
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:676
Managed reference to RelayExprNode.
Definition: expr.h:431
#define TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:713
Object::FDeleter saved_deleter_
Definition: expr.h:286
Definition: expr.h:448
bool SEqualReduce(const CallNode *other, SEqualReducer equal) const
Definition: expr.h:334
TVM_DECLARE_BASE_OBJECT_INFO(RelayExprNode, BaseExprNode)
String PrettyPrint(const ObjectRef &node)
Pretty print a node for debug purposes.
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
Definition: expr.h:555
#define TVM_DEFINE_OBJECT_REF_COW_METHOD(ObjectName)
Define CopyOnWrite function in an ObjectRef.
Definition: object.h:785
Base class of object allocators that implements make. Use curiously recurring template pattern...
Definition: memory.h:60
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:574
const String & name_hint() const
Definition: expr.h:209
TensorType tensor_type() const
GlobalVar WithFields(GlobalVar global_var, Optional< String > opt_name_hint={}, Optional< Type > opt_type={}, Optional< VirtualDevice > opt_virtual_device={}, Optional< Span > opt_span={})
Returns global_var with the given properties. A null property denotes &#39;no change&#39;. Returns global_var if all properties are unchanged. Otherwise, returns a copy with the new fields.
bool SEqualReduce(const RefCreateNode *other, SEqualReducer equal) const
Definition: expr.h:621
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:146
Expr value
The initial value of the Reference.
Definition: expr.h:612
Definition: expr.h:583
virtual ~TempExprNode()
virtual destructor
Definition: expr.h:778
Base node of all functions.
Definition: function.h:77
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:419
Expr ref
The Reference Expression.
Definition: expr.h:712
Expr value
The value we bind var to.
Definition: expr.h:415
Definition: memory.h:99
static void Deleter_(Object *ptr)
Managed reference to BaseFuncNode.
Definition: function.h:143
Base classes for the Relay IR.
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:501
Managed reference to TypeNode.
Definition: type.h:93
Definition: expr.h:659
Definition: expr.h:235
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:83
Expr value
The value to write into.
Definition: expr.h:714
bool SEqualReduce(const TupleGetItemNode *other, SEqualReducer equal) const
Definition: expr.h:570
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:129
Global variable that lives in the top-level module.
Definition: expr.h:445
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:434
Base node of all non-primitive expressions.
Definition: expr.h:359
Definition: expr.h:527
int index
which value to get
Definition: expr.h:560
runtime::NDArray data
The data of the tensor.
Definition: expr.h:75
static constexpr const uint32_t _type_child_slots
Definition: expr.h:423
container of If
Definition: expr.h:492
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:664
void DefHash(const ObjectRef &key) const
Push hash of key to the current sequence of hash values.
Definition: structural_hash.h:179
bool SEqualReduce(const RefReadNode *other, SEqualReducer equal) const
Definition: expr.h:671
Id vid
The unique identifier of the Var.
Definition: expr.h:200