CPC G06N 3/08 (2013.01) [G06N 3/044 (2023.01)] | 20 Claims |
1. A method comprising:
obtaining data representing a computational graph, the computational graph comprising a plurality of nodes and directed edges, wherein each node represents a respective operation, and wherein each directed edge connects a respective first node to a respective second node that represents an operation that receives, as input, an output of an operation represented by the respective first node;
obtaining data identifying an allocation of the computational graph across a plurality of devices, wherein the allocation assigns each node in the computational graph to a respective device of the plurality of devices;
identifying one or more sets of nodes in the computational graph that (i) represent a respective control flow statement, (ii) include one or more respective first nodes assigned to a first device that represent one or more respective first operations of the control flow statement that are to be conditionally executed, (iii) include one or more respective second nodes assigned to a second device that represent one or more respective second operations that determine whether or not or how many times the one or more respective first operations are to be recursively or iteratively executed;
for each identified set of nodes:
generating a control flow state structure that includes one or more third nodes representing operations determined based on the one or more respective second operations and that provides, as output, a current state of recursion or iteration in the control flow statement;
inserting the control flow state structure between the one or more respective first nodes and one or more respective second nodes in the computational graph; and
modifying the allocation to assign the control flow state structure to the respective first device while leaving the one or more respective second nodes assigned to the second device; and
determining, by the first device, whether to execute the one or more respective first operations of the control flow statement based on the output of the control flow state structure.
|