yobx.xbuilder.order_optim#

class yobx.xbuilder.order_optim.OrderOptimization(builder: GraphBuilder, algorithm: OrderAlgorithm = OrderAlgorithm.NONE, verbose: int = 0)[source]#

Optimizes the order of computation. It tries to minimize the distance between a producer and the consumer or a result. The idea is to reduce the memory usage.

Parameters:
  • builder – GraphBuilder holding the model

  • algorithm – to apply

  • verbose – verbosity

optimize() List[Dict[str, Any]][source]#

Optimizes the model inplace. It optimizes the model in the builder itself by switching nodes.

random_order()[source]#

Moves nodes by random.

shape_order()[source]#

Moves shape right after the node it consumes is created.