Trait OptimizationBuilder

Source
pub trait OptimizationBuilder<O>: Send {
    // Required methods
    fn register(&mut self, operation: &OperationIr);
    fn build(&self) -> O;
    fn reset(&mut self);
    fn status(&self) -> OptimizationStatus;
    fn properties(&self) -> OptimizationProperties;
    fn len(&self) -> usize;
    fn clone_dyn(&self) -> Box<dyn OptimizationBuilder<O>>;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

The fusion operation abstraction allows implementations to fuse many tensor operations into one, improving the performance of the backend.

§Notes

The implementations are free to execute the registered operations the way they want to improve the speed and efficiency of the computational graph. It doesn’t mean that all registered operations should be fused, but that another way of executing them is more efficient.

Also, it is important to return (OptimizationStatus::Closed) when no more registered operation can improve the performance.

Required Methods§

Source

fn register(&mut self, operation: &OperationIr)

Register a new tensor operation.

Source

fn build(&self) -> O

Finish the optimization and create a fusion operation.

Source

fn reset(&mut self)

Reset the state.

Source

fn status(&self) -> OptimizationStatus

Return the builder status.

Source

fn properties(&self) -> OptimizationProperties

Return the builder properties.

Source

fn len(&self) -> usize

The number of operation fused.

Source

fn clone_dyn(&self) -> Box<dyn OptimizationBuilder<O>>

Clone the optimization builder.

Provided Methods§

Source

fn is_empty(&self) -> bool

If no operations are fused.

Implementors§