pub struct BurnGraph { /* private fields */ }Expand description
Burn graph intermediate representation of modules and tensor operations.
Implementations§
Source§impl BurnGraph
impl BurnGraph
Sourcepub fn register(&mut self, node: Node)
pub fn register(&mut self, node: Node)
Register a new operation node into the graph.
§Notes
The node must be registered in the same order they will be executed in the forward pass.
Sourcepub fn with_burnpack(
self,
out_file: PathBuf,
strategy: LoadStrategy,
) -> BurnGraph
pub fn with_burnpack( self, out_file: PathBuf, strategy: LoadStrategy, ) -> BurnGraph
Save the state of each node in a burnpack file and generate weight-loading constructors.
The LoadStrategy controls which constructors are generated on the Model struct.
Sourcepub fn with_blank_space(self, blank_spaces: bool) -> BurnGraph
pub fn with_blank_space(self, blank_spaces: bool) -> BurnGraph
Sourcepub fn with_top_comment(self, top_comment: Option<String>) -> BurnGraph
pub fn with_top_comment(self, top_comment: Option<String>) -> BurnGraph
Add a comment at the top of the generated file.
Sourcepub fn with_partition(self, partition: bool) -> BurnGraph
pub fn with_partition(self, partition: bool) -> BurnGraph
Enable or disable submodule partitioning for large models.
Sourcepub fn codegen(self) -> TokenStream
pub fn codegen(self) -> TokenStream
Generate tokens representing the graph with Burn modules and tensor operations.
Sourcepub fn register_input_output(
&mut self,
input_names: Vec<String>,
output_names: Vec<String>,
input_args: &[Argument],
output_args: &[Argument],
)
pub fn register_input_output( &mut self, input_names: Vec<String>, output_names: Vec<String>, input_args: &[Argument], output_args: &[Argument], )
Register the input and output types of the graph using the passed in names. The names must be unique and match the names of the inputs and outputs of the nodes. The order will be preserved.
§Arguments
input_names- The names of the inputs of the graph.output_names- The names of the outputs of the graph.input_args- The input arguments (from ONNX graph, used for empty graphs).output_args- The output arguments (from ONNX graph, used for empty graphs).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BurnGraph
impl !RefUnwindSafe for BurnGraph
impl !Send for BurnGraph
impl !Sync for BurnGraph
impl Unpin for BurnGraph
impl UnsafeUnpin for BurnGraph
impl !UnwindSafe for BurnGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more