pub struct RogueNet {
pub config: RogueNetConfig,
pub obs_space: ObsSpace,
/* private fields */
}
Expand description
Implements the RogueNet entity neural network.
Fields§
§config: RogueNetConfig
§obs_space: ObsSpace
Implementations§
Source§impl RogueNet
impl RogueNet
Sourcepub fn load<P: AsRef<Path>>(path: P) -> RogueNet
pub fn load<P: AsRef<Path>>(path: P) -> RogueNet
Loads the parameters for a trained RogueNet neural network from a checkpoint directory produced by enn-trainer.
§Arguments
path
- Path to the checkpoint directory.
Sourcepub fn forward(&self, args: FwdArgs) -> (Array2<f32>, Vec<u64>)
pub fn forward(&self, args: FwdArgs) -> (Array2<f32>, Vec<u64>)
Runs a forward pass of the RogueNet neural network.
§Arguments
entities
- Maps each entity type to anArray2<f32>
containing the entities’ features.
§Example
use std::collections::HashMap;
use ndarray::prelude::*;
use rogue_net::{RogueNet, FwdArgs};
let rogue_net = RogueNet::load("test-data/simple");
let mut features = HashMap::new();
features.insert("Head".to_string(), array![[3.0, 4.0]]);
features.insert("SnakeSegment".to_string(), array![[3.0, 4.0], [4.0, 4.0]]);
features.insert("Food".to_string(), array![[3.0, 5.0], [8.0, 4.0]]);
let (action_probs, actions) = rogue_net.forward(FwdArgs { features, ..Default::default() });
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RogueNet
impl RefUnwindSafe for RogueNet
impl Send for RogueNet
impl Sync for RogueNet
impl Unpin for RogueNet
impl UnwindSafe for RogueNet
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.