Introduce eager.function.FuncGraph class.
FuncGraph is a subclass of CapturingGraph, and represents a function body. This is similar to _FuncGraph in framework/function.py. The eventual goal is to completely replicate the functionality, both for use in tfe.defun and cond_v2. As a PoC, FuncGraph is used instead of CapturingGraph in _trace_and_define_function. The existing unit tests provide coverage for it. As part of this change, CapturingGraph.captures is also changed from a dict to an OrderedDict. The order determines in what order the captured inputs should be passed to the final function (as well as simplifies some of the logic, since we no longer have to key by tensor ID and manually sort to get deterministic results). PiperOrigin-RevId: 207926299
Loading
Please sign in to comment