simple_context

Function simple_context 

Source
pub fn simple_context<F>(build_graph_fn: F) -> Result<Context>
where F: FnOnce(&Graph) -> Result<Node>,
Expand description

Creates a computation context with a single graph within it.

The graph is passed to the provided build_graph_fn function to specify the computation. The node returned by the function is marked as output.

§Returns

New computation context

§Example

let c = simple_context(|g| {
    let a = g.input(scalar_type(INT32))?;
    let b = g.input(scalar_type(INT32))?;
    g.add(a, b)
}).unwrap();