eryon_actors/vnode/
impl_neural.rs

1/*
2    Appellation: impl_neural <module>
3    Contrib: @FL03
4*/
5use super::NeuralNode;
6
7use crate::engine::{ComputationalEngine, NeuralEngine};
8use eryon::Tail;
9
10use ndarray::ScalarOperand;
11use num_traits::{Float, FromPrimitive, NumAssign};
12
13impl<T> NeuralNode<T>
14where
15    T: Float + FromPrimitive + ScalarOperand,
16    NeuralEngine<T>: ComputationalEngine<usize, [usize; 3], Store = Vec<usize>>,
17{
18    pub fn adapt_weights_to_target(&mut self, pattern: Tail<usize, usize>) -> crate::Result<()>
19    where
20        T: core::iter::Sum + NumAssign,
21    {
22        self.driver_mut().adapt_weights_to_target(pattern)
23    }
24    /// execute the driver with the stored data
25    pub fn execute_with_stored(&mut self) -> crate::Result<()>
26    where
27        T: core::iter::Sum + NumAssign,
28    {
29        self.driver.execute_with_stored(&self.store)
30    }
31    /// use the driver to decode the outputs of the network into a meaningful [`tail`](Tail)
32    pub fn decode_driver_output(&self, outputs: ndarray::Array1<T>) -> Tail<usize, usize> {
33        self.driver().decode_outputs_into_tail(outputs)
34    }
35}