Struct neuronika::nn::Reflective [−][src]
pub struct Reflective;
Expand description
Reflective padding.
See .pad()
for more informations.
Trait Implementations
Pads the input array in place using the reflection of its boundary.
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 using the reflection of the input boundary.
Only 1, 2 and 3 dimensional arrays support reflective padding.
Arguments
-
input
- the array to be padded. -
padding
- the amount of padding for each dimension.
Examples
use neuronika::nn::{PaddingMode, Reflective};
let padding = Reflective;
let arr = ndarray::array![
[1., 2., 3.],
[4., 5., 6.],
[7., 8., 9.]
];
let padded = padding.pad(&arr, (1, 1));
let result = ndarray::array![
[5., 4., 5., 6., 5.],
[2., 1., 2., 3., 2.],
[5., 4., 5., 6., 5.],
[8., 7., 8., 9., 8.],
[5., 4., 5., 6., 5.]
];
assert_eq!(padded, result);
Auto Trait Implementations
impl RefUnwindSafe for Reflective
impl Send for Reflective
impl Sync for Reflective
impl Unpin for Reflective
impl UnwindSafe for Reflective
Blanket Implementations
Mutably borrows from an owned value. Read more