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

Method create_graph

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

Creates an empty computation graph in this context. # Returns New computation graph # Example ``` # use ciphercore_base::graphs::create_context; let c = create_context().unwrap(); let g = c.create_graph().unwrap(); ```

(&self)

Source from the content-addressed store, hash-verified

3907 /// let g = c.create_graph().unwrap();
3908 /// ```
3909 pub fn create_graph(&self) -> Result<Graph> {
3910 if self.body.borrow().finalized {
3911 return Err(runtime_error!("Can't add a graph to a finalized context"));
3912 }
3913 let id = self.body.borrow().graphs.len() as u64;
3914 let result = Graph {
3915 body: Arc::new(AtomicRefCell::new(GraphBody {
3916 finalized: false,
3917 nodes: vec![],
3918 output_node: None,
3919 id,
3920 context: self.downgrade(),
3921 })),
3922 };
3923 self.body.borrow_mut().graphs.push(result.clone());
3924 Ok(result)
3925 }
3926
3927 /// Finalizes the context if all its graphs are finalized and the main graph is set.
3928 ///

Callers 15

test_malformedFunction · 0.45
test_inputFunction · 0.45
test_zeros_and_onesFunction · 0.45
test_addFunction · 0.45
mixed_multiply_helperFunction · 0.45
test_dot_workerFunction · 0.45
test_dot_worker_failFunction · 0.45
test_matmul_workerFunction · 0.45
test_matmul_worker_failFunction · 0.45
test_truncate_workerFunction · 0.45
test_sum_workerFunction · 0.45

Calls 3

downgradeMethod · 0.80
cloneMethod · 0.80
pushMethod · 0.45

Tested by 15

test_malformedFunction · 0.36
test_inputFunction · 0.36
test_zeros_and_onesFunction · 0.36
test_addFunction · 0.36
test_dot_workerFunction · 0.36
test_dot_worker_failFunction · 0.36
test_matmul_workerFunction · 0.36
test_matmul_worker_failFunction · 0.36
test_truncate_workerFunction · 0.36
test_sum_workerFunction · 0.36
test_sum_worker_failFunction · 0.36