Struct auto_diff::compute_graph::Net
source · [−]pub struct Net { /* private fields */ }
Expand description
The computation network. Connection has duplication.
Implementations
sourceimpl Net
impl Net
pub fn new() -> Net
pub fn get_data(&self) -> &GenIndex<Tensor>
pub fn get_data_mut(&mut self) -> &mut GenIndex<Tensor>
pub fn get_ops(&self) -> &GenIndex<Op>
pub fn get_ops_mut(&mut self) -> &mut GenIndex<Op>
pub fn add_tensor(&mut self, t: Tensor) -> GenKey
pub fn get_tensor(&self, id: GenKey) -> Result<Tensor, AutoDiffError>
pub fn set_tensor(
&mut self,
id: GenKey,
val: Tensor
) -> Result<(), AutoDiffError>
pub fn get_op(&self, id: GenKey) -> Result<Op, AutoDiffError>
pub fn get_grad(&self, id: GenKey) -> Result<Tensor, AutoDiffError>
pub fn get_input_edge_data(&self) -> BTreeSet<GenKey>
pub fn get_output_edge_data(&self) -> BTreeSet<GenKey>
sourcepub fn connect(&mut self, input: &[GenKey], op: GenKey, output: &[GenKey])
pub fn connect(&mut self, input: &[GenKey], op: GenKey, output: &[GenKey])
Build input-operator-output relation, with given components.
sourcepub fn set_mark(&mut self, did: &GenKey)
pub fn set_mark(&mut self, did: &GenKey)
set the set_mark, set_mark is used to label var with input value with it.
pub fn unset_mark(&mut self, did: &GenKey)
sourcepub fn eval(&mut self, starting_node: &[GenKey]) -> Result<(), BTreeSet<GenKey>>
pub fn eval(&mut self, starting_node: &[GenKey]) -> Result<(), BTreeSet<GenKey>>
Forward evaluate the computaiton graph.
pub fn bptt(&mut self, output_grad: &BTreeMap<GenKey, Tensor>)
sourcepub fn visit_op<F>(
&mut self,
closure: F,
allow: Option<Vec<GenKey>>,
skip: Option<Vec<GenKey>>
) where
F: Fn(&Op),
pub fn visit_op<F>(
&mut self,
closure: F,
allow: Option<Vec<GenKey>>,
skip: Option<Vec<GenKey>>
) where
F: Fn(&Op),
Iterate over all ops, no order guarantee
pub fn visit_data<F>(&mut self, closure: F) where
F: Fn(GenKey, &Tensor),
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Net
impl<'de> Deserialize<'de> for Net
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Net
impl !Send for Net
impl !Sync for Net
impl Unpin for Net
impl !UnwindSafe for Net
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more