pub struct Graph<C> { /* private fields */ }Expand description
graph like ai operation structure
Implementations§
Source§impl<C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge> Graph<C>
impl<C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge> Graph<C>
Sourcepub fn add_connection<'a>(&mut self, config: &ConnectionEditor<'a, C, V>)
pub fn add_connection<'a>(&mut self, config: &ConnectionEditor<'a, C, V>)
adds a connection between two vertices
Sourcepub fn add_layer<X: Into<C>, L: Into<Label>>(&mut self, label: L, layer: X)
pub fn add_layer<X: Into<C>, L: Into<Label>>(&mut self, label: L, layer: X)
adds a layer without connecting it
Sourcepub fn connect<I: Into<Label>, O: Into<Label>>(
&mut self,
input: I,
output: O,
) -> ConnectionEditor<'_, C, V>
pub fn connect<I: Into<Label>, O: Into<Label>>( &mut self, input: I, output: O, ) -> ConnectionEditor<'_, C, V>
adds a connection between vertices
Sourcepub fn connections<'a>(
&'a self,
) -> impl Iterator<Item = ConnectionInfo<'a, C, V>>
pub fn connections<'a>( &'a self, ) -> impl Iterator<Item = ConnectionInfo<'a, C, V>>
returns an iterator over the connections in an arbitrary order
Sourcepub fn get_connection<'a>(
&'a self,
label: &Label,
) -> Option<ConnectionInfo<'a, C, V>>
pub fn get_connection<'a>( &'a self, label: &Label, ) -> Option<ConnectionInfo<'a, C, V>>
gets connection information by label
Sourcepub fn split<F: FnMut(bool, &Label, &Label, &C, &Label, &Label) -> bool>(
&mut self,
predicate: F,
) -> Selfwhere
C: Clone,
pub fn split<F: FnMut(bool, &Label, &Label, &C, &Label, &Label) -> bool>(
&mut self,
predicate: F,
) -> Selfwhere
C: Clone,
splits the graph according to the predicate(clear, connectionlabel, inputlabel, layer, layerlabel, outputlabel). true will be sent to the returned graph. the resulting graphs will only have the layers they use
Trait Implementations§
Source§impl<C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge, S: BuildHasher> AI<HashMap<Label, V, S>, HashMap<Label, V, S>> for Graph<C>
impl<C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge, S: BuildHasher> AI<HashMap<Label, V, S>, HashMap<Label, V, S>> for Graph<C>
Source§impl<C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge> AI<Vec<V>, Vec<V>> for Graph<C>
impl<C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge> AI<Vec<V>, Vec<V>> for Graph<C>
Source§impl<C: Decompose> Decompose for Graph<C>
impl<C: Decompose> Decompose for Graph<C>
Source§type Decomposition = (Vec<(String, (u64, String, String, String))>, Vec<(String, <C as Decompose>::Decomposition)>)
type Decomposition = (Vec<(String, (u64, String, String, String))>, Vec<(String, <C as Decompose>::Decomposition)>)
the decomposed type
Source§fn compose((connections, layers): Self::Decomposition) -> Self
fn compose((connections, layers): Self::Decomposition) -> Self
recreates from the decomposition
Source§fn decompose(self) -> Self::Decomposition
fn decompose(self) -> Self::Decomposition
owned decomposition
Source§fn decompose_cloned(&self) -> Self::Decomposition
fn decompose_cloned(&self) -> Self::Decomposition
decomposition that copies data
Source§impl<'de, C> Deserialize<'de> for Graph<C>where
C: Deserialize<'de>,
impl<'de, C> Deserialize<'de> for Graph<C>where
C: Deserialize<'de>,
Source§fn 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
Source§impl<A: Into<C>, C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge> Extend<Graph<A>> for Graph<C>
impl<A: Into<C>, C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge> Extend<Graph<A>> for Graph<C>
Source§fn extend<I: IntoIterator<Item = Graph<A>>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Graph<A>>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<A: Into<C>, C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge> FromIterator<Graph<A>> for Graph<C>
impl<A: Into<C>, C: AI<V, V> + Op<Output = V>, V: Clone + Default + Merge> FromIterator<Graph<A>> for Graph<C>
Source§impl<C: Op> Op for Graph<C>
impl<C: Op> Op for Graph<C>
Source§type Output = Vec<<C as Op>::Output>
type Output = Vec<<C as Op>::Output>
suggested output type to help with composition coherence. Ideally, Self should implement AI<X,Self::Output> for some X
Source§fn abnormal_softmax(self, temperature: f32) -> AbnormalSoftmax<Self>
fn abnormal_softmax(self, temperature: f32) -> AbnormalSoftmax<Self>
wraps with a softmax operation
Source§fn chain<B>(self, b: B) -> Sequential<(Self, B)>
fn chain<B>(self, b: B) -> Sequential<(Self, B)>
sequences with another ai operation
Source§fn forward_fixed<Z>(&self, input: Z) -> Z
fn forward_fixed<Z>(&self, input: Z) -> Z
applies to the input
Source§fn forward_fixed_mut<Z>(&mut self, input: Z) -> Z
fn forward_fixed_mut<Z>(&mut self, input: Z) -> Z
applies to the input
Source§fn forward_typed<W, Z>(&self, input: W) -> Z
fn forward_typed<W, Z>(&self, input: W) -> Z
applies to the input
Source§fn forward_typed_mut<W, Z>(&mut self, input: W) -> Z
fn forward_typed_mut<W, Z>(&mut self, input: W) -> Z
applies to the input, possibly updating internal caches
Source§fn infer_autoregressive<X, Y>(self, input: X) -> Autoregression<Self, Y> ⓘ
fn infer_autoregressive<X, Y>(self, input: X) -> Autoregression<Self, Y> ⓘ
creates an autoregressive inference
Source§fn log_softmax(self, temperature: f32) -> LogSoftmax<Self>
fn log_softmax(self, temperature: f32) -> LogSoftmax<Self>
wraps with a softmax operation
Source§fn map<B>(self, b: B) -> Map<Sequential<(Self, B)>>
fn map<B>(self, b: B) -> Map<Sequential<(Self, B)>>
applies the operation to every output
Source§fn squared_error(self) -> SquaredError<Self>
fn squared_error(self) -> SquaredError<Self>
wraps with a mse operation
Source§fn wrap_inner(self) -> Inner<Self>where
Self: Sized,
fn wrap_inner(self) -> Inner<Self>where
Self: Sized,
wraps the inner value so it can be unwrapped with unwrap inner
impl<C: Eq> Eq for Graph<C>
impl<C> StructuralPartialEq for Graph<C>
Auto Trait Implementations§
impl<C> Freeze for Graph<C>
impl<C> RefUnwindSafe for Graph<C>where
C: RefUnwindSafe,
impl<C> Send for Graph<C>where
C: Send,
impl<C> Sync for Graph<C>where
C: Sync,
impl<C> Unpin for Graph<C>where
C: Unpin,
impl<C> UnwindSafe for Graph<C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Shortcuts for T
impl<T> Shortcuts for T
Source§fn classification(self) -> Classification<Self>
fn classification(self) -> Classification<Self>
wraps in a classification wrapper
Source§fn regression(self) -> Regression<Self>
fn regression(self) -> Regression<Self>
wraps in a regression wrapper