Skip to main content

OperationFuser

Trait OperationFuser 

pub trait OperationFuser<O>: Send {
    // Required methods
    fn fuse(&mut self, operation: &OperationIr);
    fn finish(&mut self) -> O;
    fn reset(&mut self);
    fn status(&self) -> FuserStatus;
    fn properties(&self) -> FuserProperties;
    fn len(&self) -> usize;
    fn clone_dyn(&self) -> Box<dyn OperationFuser<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 (FuserStatus::Closed) when no more registered operation can improve the performance.

Required Methods§

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

Register a new tensor operation.

fn finish(&mut self) -> O

Finish the optimization and create a fusion operation.

fn reset(&mut self)

Reset the state.

fn status(&self) -> FuserStatus

Return the builder status.

fn properties(&self) -> FuserProperties

Return the builder properties.

fn len(&self) -> usize

The number of operation fused.

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

Clone the optimization builder.

Provided Methods§

fn is_empty(&self) -> bool

If no operations are fused.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§