#[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,
pub arity: Option<usize>,
pub arg_sorts: Option<Vec<i64>>,
pub artifact_hash: Option<String>,
}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.
arity: Option<usize>Number of arguments the network’s declared predicate(s) take, as
stated by the caller at registration time. None means unstated.
When present, this is validated against every nn/4 declaration
bound to this network name (see register_network), so a mismatch
between what the caller claims and what the program actually
declared is rejected rather than trusted.
arg_sorts: Option<Vec<i64>>Per-argument catalog sort ids, in declared-argument order. Carried
opaquely: the registry does not interpret or validate these against
the program, it only stores them so callers (e.g. slot-matching
enumeration) can sort-match candidate slots by id. Validated at the
pyo3 boundary (register_network) to be Python ints, with bool
explicitly excluded even though isinstance(True, int) holds.
artifact_hash: Option<String>Content hash of the registered artifact (module weights). Carried
opaquely, like arg_sorts: a retrained network is expected to mint a
new hash, so this field is the identity of this registration, not
a claim the registry checks.
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more