Skip to main content

BatchNorm3d

Struct BatchNorm3d 

Source
pub struct BatchNorm3d<D: Dtype, IT, OT, const RANK: usize> {
    pub num_features: usize,
    pub eps: f64,
    pub momentum: f64,
    pub affine: bool,
    pub track_running_stats: bool,
    /* private fields */
}
Expand description

Batch normalisation over a 5-D [N, C, D, H, W] input.

Applies the same statistics as BatchNorm1d but treats each (C) channel independently across the (N, D, H, W) axes.

Fields§

§num_features: usize

Number of channels/features.

§eps: f64

Numerical stability constant added to the variance.

§momentum: f64

Weight of the current batch in the running-stats exponential moving average.

§affine: bool

Whether to learn per-channel scale (gamma) and shift (beta) parameters.

§track_running_stats: bool

Whether to maintain running mean/variance across batches.

Implementations§

Source§

impl<D: Dtype, IT, OT, const RANK: usize> BatchNorm3d<D, IT, OT, RANK>

Source

pub fn new(num_features: usize) -> Self

Creates a new layer with default eps/momentum/affine/track_running_stats.

Source

pub fn with_eps(self, eps: f64) -> Self

Sets the numerical stability constant.

Source

pub fn with_momentum(self, momentum: f64) -> Self

Sets the running-stats EMA momentum.

Source

pub fn with_affine(self, affine: bool) -> Self

Sets whether to learn per-channel scale/shift parameters.

Source

pub fn with_track_running_stats(self, track: bool) -> Self

Sets whether to maintain running mean/variance across batches.

Trait Implementations§

Source§

impl<D: Dtype, IT: Tensor<D, RANK> + EagerTensor, OT: Tensor<D, RANK>, const RANK: usize> Layer<IT> for BatchNorm3d<D, IT, OT, RANK>

Source§

type Output = OT

This layer’s output type.
Source§

fn call(&self, _input: IT) -> Self::Output

Applies this layer to input.
Source§

impl<D: Dtype, const RANK: usize> Layer<SymTensor> for BatchNorm3d<D, SymTensor, SymTensor, RANK>

Source§

type Output = SymTensor

This layer’s output type.
Source§

fn call(&self, input: SymTensor) -> SymTensor

Applies this layer to input.

Auto Trait Implementations§

§

impl<D, IT, OT, const RANK: usize> Freeze for BatchNorm3d<D, IT, OT, RANK>

§

impl<D, IT, OT, const RANK: usize> RefUnwindSafe for BatchNorm3d<D, IT, OT, RANK>

§

impl<D, IT, OT, const RANK: usize> Send for BatchNorm3d<D, IT, OT, RANK>
where D: Send, IT: Send, OT: Send,

§

impl<D, IT, OT, const RANK: usize> Sync for BatchNorm3d<D, IT, OT, RANK>
where D: Sync, IT: Sync, OT: Sync,

§

impl<D, IT, OT, const RANK: usize> Unpin for BatchNorm3d<D, IT, OT, RANK>
where D: Unpin, IT: Unpin, OT: Unpin,

§

impl<D, IT, OT, const RANK: usize> UnsafeUnpin for BatchNorm3d<D, IT, OT, RANK>

§

impl<D, IT, OT, const RANK: usize> UnwindSafe for BatchNorm3d<D, IT, OT, RANK>
where D: UnwindSafe, IT: UnwindSafe, OT: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.