see #4139 .
Currently, relay evaluate a function to a closure. It contain both the code of 
the function, and a mapping of every free variable inside that function, to the 
value of the free variable. when a closure is invoked, that mapping is used for 
the free variable. This is needed because the default approach, looking up the 
value from the environment (also known as dynamic binding), is buggy and will 
cause incorrect evaluation.
However, when a recursive closure is created, the mapping will contain value of 
every free variable - including the recursive function, and, subsequently, the 
closure itself!
I propose to add the following value, a RecValue, and a RecTable.
A RecValue is a shared_ptr of a RecTable, and a size_t index.
A RecTable is a vector of Closure.
Additionally, every closure will now have a Map<Variable, size_t> mapping, 
which store value of mutually recursive variable

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dmlc/tvm/issues/4143

Reply via email to