pub struct RogueNet {
    pub config: RogueNetConfig,
    pub obs_space: ObsSpace,
    /* private fields */
}
Expand description

Implements the RogueNet entity neural network.

Fields

config: RogueNetConfigobs_space: ObsSpace

Implementations

Loads the parameters for a trained RogueNet neural network from a checkpoint directory produced by enn-trainer.

Arguments
  • path - Path to the checkpoint directory.

Loads the parameters for a trained RogueNet neural network from a tar archive of a checkpoint directory.

Arguments
  • r - A reader for the tar archive.
Example
use std::fs::File;
use rogue_net::RogueNet;

let rogue_net = RogueNet::load_archive(File::open("test-data/simple.roguenet").unwrap());

Runs a forward pass of the RogueNet neural network.

Arguments
  • entities - Maps each entity type to an Array2<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() });

Adapts the RogueNet neural network to the given observation space by filtering out any features that were not present during training.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.