logo

Struct neuronika::nn::Constant[][src]

pub struct Constant {
    pub value: f32,
}
Expand description

Constant padding.

See .pad() for more informations.

Fields

value: f32

Implementations

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Pads the input array in place using a constant value.

See .pad() for more informations.

Arguments
  • input - array to be padded.

  • original - the original unpadded array.

  • padding - slice specifying the amount of padding for each dimension.

Panics

If padding length doesn’t match input’s dimensions.

Pads the input array with a constant value.

Arguments
  • input - the array to be padded.

  • padding - the amount of padding for each dimension.

  • value - the value for the padding.

Examples
use neuronika::nn::{PaddingMode, Constant};

let padding = Constant::new(8.);
let arr = ndarray::array![
   [1., 2., 3.],
   [4., 5., 6.],
   [7., 8., 9.]
];
let padded = padding.pad(&arr, (1, 1));
let result = ndarray::array![
   [8., 8., 8., 8., 8.],
   [8., 1., 2., 3., 8.],
   [8., 4., 5., 6., 8.],
   [8., 7., 8., 9., 8.],
   [8., 8., 8., 8., 8.]
];

assert_eq!(padded, result);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.