How does relay define the IR's data structure?


#1

I am confused about the data structure of realy IR.From https://docs.tvm.ai/langref/relay_adt.html I learnt that relay use ADT to define the data structure,but i can’t find how to do that.


#2

Inside relay, u can use ADT to define more datastructure. But the data structure of Relay (AST) is not defined using ADT. It is defined in https://github.com/dmlc/tvm/blob/master/include/tvm/relay/expr.h https://github.com/dmlc/tvm/blob/master/include/tvm/relay/type.h and https://github.com/dmlc/tvm/blob/master/include/tvm/relay/adt.h


#3

Thank you for your answer!
But I still have a doubt about relay. Is the essence of the relay language AST? Is relay expr the text format of relay ast?


#4

when we speak about relay, most of the time we talk about the relay ast.
relay expr is definitely relay ast.
relay text-format is the text format, and I do not think anyone call the format ‘relay’. Even if they do, it should be pretty obvious from the context which one is it/