pub struct Conv3d(/* private fields */);Expand description
Named-channel 3D cross-correlation followed by bias addition.
The three spatial axes conventionally represent depth, height, and width;
kernel, stride, and symmetric padding arrays use that same supplied order.
Stride defaults to [1, 1, 1], padding to [0, 0, 0], and groups to 1.
Dilation and asymmetric padding are not supported.
The backend computes patch indices from compact geometry and uses a deterministic input-centric derivative, but materializes the FP32 patch tensor before contraction. Downstream layout operations still have the generic index-plan limits documented by Axis.
Implementations§
Source§impl Conv3d
impl Conv3d
pub fn new( input: Axis, output: Dim, spatial: [Axis; 3], kernel: [usize; 3], ) -> Self
Sourcepub fn stride(self, stride: [usize; 3]) -> Self
pub fn stride(self, stride: [usize; 3]) -> Self
Set stride in the order of the supplied spatial axes.
Sourcepub fn padding(self, padding: [usize; 3]) -> Self
pub fn padding(self, padding: [usize; 3]) -> Self
Set symmetric zero-padding in the order of the supplied spatial axes.
Sourcepub fn groups(self, groups: usize) -> Self
pub fn groups(self, groups: usize) -> Self
Partition input and output channels into independent convolution groups.
Sourcepub fn bias(self, bias: bool) -> Self
pub fn bias(self, bias: bool) -> Self
Disable the learned bias term, matching crate::Linear::bias. Has no effect once build
has already allocated parameters; call it before build.
Trait Implementations§
Source§impl Module for Conv3d
impl Module for Conv3d
fn output_shape(&self, input: &Shape) -> Result<Shape>
Source§fn build(&mut self, input: &Shape, device: &Device, seed: u64) -> Result<Shape>
fn build(&mut self, input: &Shape, device: &Device, seed: u64) -> Result<Shape>
Source§fn forward(&self, input: &Tensor) -> Result<Tensor>
fn forward(&self, input: &Tensor) -> Result<Tensor>
self, no randomness beyond what
forward itself already defines. This never changes with the arrival
of forward_training.Source§fn named_parameters(&self) -> Vec<(String, Parameter)>
fn named_parameters(&self) -> Vec<(String, Parameter)>
Source§fn forward_training(
&self,
input: &Tensor,
pass: &mut TrainingPass,
) -> Result<Tensor>
fn forward_training( &self, input: &Tensor, pass: &mut TrainingPass, ) -> Result<Tensor>
TrainingPass
rather than a flag on self. The default implementation ignores
pass and calls Module::forward, which is exactly today’s
behavior for every module without a train/eval distinction. Override
this (never forward, which must stay evaluation semantics) to add
explicit randomness or a train/eval difference, such as Dropout.
A container that holds child modules (Sequential, or any future
one) overrides this to thread the same pass through every child in
order, so their draws stay distinct within one step.fn parameter(&self, name: &str) -> Result<Parameter>
fn parameters(&self) -> Vec<Parameter>
fn zero_grad(&self)
Source§fn named_states(&self) -> Vec<(String, State)>
fn named_states(&self) -> Vec<(String, State)>
BatchNorm-style running statistics. Same slot-path
convention as Module::named_parameters: a container (Sequential
or any future one) aggregates every child’s own states under
"{index}.{name}". Defaults empty, exactly like named_parameters,
since most modules have no persistent state. A State here is never
written directly; only TrainingPass::commit writes one, after
staging in forward_training.