MCPcopy Index your code
hub / github.com/ciphermodelabs/ciphercore / simple_context

Function simple_context

ciphercore-base/src/graphs.rs:4818–4830  ·  view source on GitHub ↗

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 ``` # use ciphercore_base::graphs::util::simple_context; # use ciphercore_base::data_types::{scalar_type, INT32}; let c = simple_context(|g| { le

(build_graph_fn: F)

Source from the content-addressed store, hash-verified

4816 /// }).unwrap();
4817 /// ```
4818 pub fn simple_context<F>(build_graph_fn: F) -> Result<Context>
4819 where
4820 F: FnOnce(&Graph) -> Result<Node>,
4821 {
4822 let c = create_context()?;
4823 let g = c.create_graph()?;
4824 let out = build_graph_fn(&g)?;
4825 out.set_as_output()?;
4826 g.finalize()?;
4827 g.set_as_main()?;
4828 c.finalize()?;
4829 Ok(c)
4830 }
4831}
4832
4833#[cfg(test)]

Callers 15

test_instantiation_passFunction · 0.85
custom_reduce_vec_helperFunction · 0.85
custom_reduce_helperFunction · 0.85
test_well_behavedFunction · 0.85
test_broadcast_divisorFunction · 0.85
test_broadcast_dividendFunction · 0.85
long_division_helperFunction · 0.85
binary_helperFunction · 0.85
arithmetic_helperFunction · 0.85
scalar_helperFunction · 0.85
array_helperFunction · 0.85

Calls 5

create_contextFunction · 0.70
create_graphMethod · 0.45
set_as_outputMethod · 0.45
finalizeMethod · 0.45
set_as_mainMethod · 0.45

Tested by 15

test_instantiation_passFunction · 0.68
test_well_behavedFunction · 0.68
test_broadcast_divisorFunction · 0.68
test_broadcast_dividendFunction · 0.68
binary_helperFunction · 0.68
arithmetic_helperFunction · 0.68
test_helperFunction · 0.68
test_well_formedFunction · 0.68
test_vectorFunction · 0.68
test_helperFunction · 0.68