#[non_exhaustive]pub struct NetworkConfig {
pub name: String,
pub batching: bool,
pub k: Option<usize>,
pub det: bool,
pub cache_enabled: bool,
pub cache_size: usize,
}Expand description
Configuration for registering a neural network.
This mirrors the DeepProbLog register_network options.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringUnique name identifying this network (must match nn() declarations)
batching: boolWhether to batch inputs for efficient GPU processing. When true, multiple queries are grouped into a single forward pass.
k: Option<usize>Top-k sampling: if Some(k), only consider the top k outputs. Useful for large output spaces where most classes have near-zero probability.
det: boolDeterministic mode: use argmax instead of probabilistic sampling. Useful for debugging and when you want reproducible results.
cache_enabled: boolWhether to cache network outputs. Caching avoids redundant forward passes for repeated inputs.
cache_size: usizeMaximum number of entries in the output cache.
Implementations§
Source§impl NetworkConfig
impl NetworkConfig
Sourcepub fn default(name: &str) -> Self
pub fn default(name: &str) -> Self
Create a default configuration for a network with the given name.
Default settings:
- batching: true
- k: None (consider all outputs)
- det: false (probabilistic mode)
- cache_enabled: true
- cache_size: 10000
Sourcepub fn deterministic(name: &str) -> Self
pub fn deterministic(name: &str) -> Self
Create a configuration for a deterministic network.
Sourcepub fn with_top_k(name: &str, k: usize) -> Self
pub fn with_top_k(name: &str, k: usize) -> Self
Create a configuration with top-k sampling.
Trait Implementations§
Source§impl Clone for NetworkConfig
impl Clone for NetworkConfig
Source§fn clone(&self) -> NetworkConfig
fn clone(&self) -> NetworkConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more