-
Notifications
You must be signed in to change notification settings - Fork 64
Description
I was thinking about integrating ChainRules into Yota. However, there's a major obstacle for this - pullback functions returned by rrule are closures, and Yota doesn't support closures.
There are several reasons for not supporting closures (or at least not making them the default mechanism), but the main one is bad interoperability with other systems. For example, one big thing I want to have from AD system is the ability to serialize computational graphs to ONNX format. ONNX spec describes nodes as:
Computation nodes are comprised of a name, the name of an operator that it invokes, a list of named inputs, a list of named outputs, and a list of attributes.
So every operator should be uniquely identified just by its name, and the name should be known beforehand. Closures don't seem to match this rule. It's ok to have some graphs which are not serializable to ONNX, but as far as I understand using ChainRules means that all nearly graphs should use closures.
I started to think if it's possible to "extract" pullback and convert it to an ordinary function. I even have a rough plan how to rewrite rrules using IRTools, for example. But I'm 95% sure it won't end well :)
But maybe I'm missing something? Maybe there are previous discussions or implementations in other AD systems which somehow get around this issue?