pub struct SnakeCNNInference {Show 17 fields
pub grid_width: usize,
pub grid_height: usize,
pub input_channels: usize,
pub num_actions: usize,
pub conv1_weight: Vec<Vec<Vec<Vec<f32>>>>,
pub conv1_bias: Vec<f32>,
pub conv2_weight: Vec<Vec<Vec<Vec<f32>>>>,
pub conv2_bias: Vec<f32>,
pub conv3_weight: Vec<Vec<Vec<Vec<f32>>>>,
pub conv3_bias: Vec<f32>,
pub fc_common_weight: Vec<Vec<f32>>,
pub fc_common_bias: Vec<f32>,
pub fc_policy_weight: Vec<Vec<f32>>,
pub fc_policy_bias: Vec<f32>,
pub fc_value_weight: Vec<Vec<f32>>,
pub fc_value_bias: Vec<f32>,
pub metadata: Option<TrainingMetadata>,
}Expand description
A serializable CNN model for Snake inference
This struct contains all the weights and biases needed to run CNN inference in pure Rust (no Burn/tensor-stack dependency).
Fields§
§grid_width: usizeGrid width
grid_height: usizeGrid height
input_channels: usizeNumber of input channels (should be 5 for Snake)
num_actions: usizeNumber of actions (should be 4 for Snake)
conv1_weight: Vec<Vec<Vec<Vec<f32>>>>Conv1 kernel weights, shape [out=32, in=input_channels, kh=3, kw=3].
Applied first in SnakeCNNInference::forward with padding=1.
conv1_bias: Vec<f32>Conv1 per-output-channel bias, shape [32].
conv2_weight: Vec<Vec<Vec<Vec<f32>>>>Conv2 kernel weights, shape [out=64, in=32, kh=3, kw=3]. Applied
after Conv1 + ReLU with padding=1.
conv2_bias: Vec<f32>Conv2 per-output-channel bias, shape [64].
conv3_weight: Vec<Vec<Vec<Vec<f32>>>>Conv3 kernel weights, shape [out=64, in=64, kh=3, kw=3]. Applied
after Conv2 + ReLU with padding=1.
conv3_bias: Vec<f32>Conv3 per-output-channel bias, shape [64].
fc_common_weight: Vec<Vec<f32>>Shared fully-connected weights, shape
[256, 64 * grid_width * grid_height], applied to the flattened
Conv3 output.
fc_common_bias: Vec<f32>Shared fully-connected bias, shape [256].
fc_policy_weight: Vec<Vec<f32>>Policy head weights, shape [num_actions, 256]. Output is raw logits
(no softmax applied here — callers do that in
SnakeCNNInference::get_action or externally).
fc_policy_bias: Vec<f32>Policy head bias, shape [num_actions].
fc_value_weight: Vec<Vec<f32>>Value head weights, shape [1, 256]. Produces a scalar state-value
estimate (no activation).
fc_value_bias: Vec<f32>Value head bias, shape [1].
metadata: Option<TrainingMetadata>Optional training metadata
Implementations§
Trait Implementations§
Source§impl Clone for SnakeCNNInference
impl Clone for SnakeCNNInference
Source§fn clone(&self) -> SnakeCNNInference
fn clone(&self) -> SnakeCNNInference
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SnakeCNNInference
impl Debug for SnakeCNNInference
Source§impl<'de> Deserialize<'de> for SnakeCNNInference
impl<'de> Deserialize<'de> for SnakeCNNInference
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SnakeCNNInference
impl RefUnwindSafe for SnakeCNNInference
impl Send for SnakeCNNInference
impl Sync for SnakeCNNInference
impl Unpin for SnakeCNNInference
impl UnsafeUnpin for SnakeCNNInference
impl UnwindSafe for SnakeCNNInference
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more