pub struct NeuralNetGraph {
pub graph: Graph<NeuronNode, SynapseEdge>,
pub layers: Vec<Vec<NodeId>>,
pub layer_count: usize,
}Fields§
§graph: Graph<NeuronNode, SynapseEdge>§layers: Vec<Vec<NodeId>>layer_index -> Vec
layer_count: usizeImplementations§
Source§impl NeuralNetGraph
impl NeuralNetGraph
pub fn neuron_count(&self) -> usize
pub fn synapse_count(&self) -> usize
pub fn get_neuron(&self, id: NodeId) -> Option<&NeuronNode>
pub fn get_synapse(&self, id: EdgeId) -> Option<&SynapseEdge>
Sourcepub fn set_activations(&mut self, layer: usize, values: &[f32])
pub fn set_activations(&mut self, layer: usize, values: &[f32])
Set activations for a specific layer.
Sourcepub fn set_weights(&mut self, from_layer: usize, weights: &[Vec<f32>])
pub fn set_weights(&mut self, from_layer: usize, weights: &[Vec<f32>])
Set all weights for edges between two layers.
Sourcepub fn compute_layout(&self, bounds: Vec2) -> HashMap<NodeId, Vec2>
pub fn compute_layout(&self, bounds: Vec2) -> HashMap<NodeId, Vec2>
Generate layout: neurons in vertical columns per layer.
Sourcepub fn render_data(&self) -> NeuralRenderData
pub fn render_data(&self) -> NeuralRenderData
Generate rendering data: node brightness = activation, edge thickness = |weight|, edge color by sign.
Trait Implementations§
Source§impl Clone for NeuralNetGraph
impl Clone for NeuralNetGraph
Source§fn clone(&self) -> NeuralNetGraph
fn clone(&self) -> NeuralNetGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NeuralNetGraph
impl RefUnwindSafe for NeuralNetGraph
impl Send for NeuralNetGraph
impl Sync for NeuralNetGraph
impl Unpin for NeuralNetGraph
impl UnsafeUnpin for NeuralNetGraph
impl UnwindSafe for NeuralNetGraph
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.