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
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
impl RefUnwindSafe for Constant
impl UnwindSafe for Constant
Blanket Implementations
Mutably borrows from an owned value. Read more