Attribute Macro const_cge::network

source · []
#[network]
Expand description

Adds the required fields and functions for executing a network loaded from a CGE file.

  • If your network has recurrent architecture, it only works on unit structs (no fields).
  • If your network has non-recurrent architecture, it works on any struct or enum.
  • To control target numeric type (f32/f64), use the numeric_type attribute: #[network("net.cge", numeric_type = f32).
use const_cge::network;
 
/// Controls the robot's limbs, predicting motor actuations
/// that will move it in the desired direction.
#[network("./walker.cge")]
struct Walker;
 
fn main() {
  let mut walk = Walker::default();
  walk.evaluate(&inputs, &mut outputs);
}