pub fn export_to_torchscript_text(
graph: &EinsumGraph,
) -> Result<String, IrError>Expand description
Export EinsumGraph to TorchScript text representation.
This creates a PyTorch TorchScript representation that can be loaded and executed by PyTorch’s JIT compiler.
§Examples
use tensorlogic_ir::{EinsumGraph, EinsumNode};
use tensorlogic_ir::export_to_torchscript_text;
let mut graph = EinsumGraph::new();
let x = graph.add_tensor("X");
let w = graph.add_tensor("W");
let y = graph.add_tensor("Y");
graph.add_node(EinsumNode::einsum("ij,jk->ik", vec![x, w], vec![y])).unwrap();
graph.add_output(y).unwrap();
let script = export_to_torchscript_text(&graph).unwrap();
assert!(script.contains("torch.einsum"));