pub struct Layout {
pub dims: Vec<usize>,
pub padded: Vec<usize>,
pub modes: Vec<usize>,
pub strides: Vec<usize>,
pub order: DigitOrder,
pub pad: PadPolicy,
}Expand description
The tensorization of one grid.
Fields§
§dims: Vec<usize>Original grid shape (row-major, last axis fastest).
padded: Vec<usize>Padded grid shape.
modes: Vec<usize>Tensor mode sizes, most significant first.
strides: Vec<usize>For each tensor mode, the stride of that digit in the padded grid.
order: DigitOrderDigit order used.
pad: PadPolicyPadding policy used.
Implementations§
Source§impl Layout
impl Layout
Sourcepub fn new(dims: &[usize], order: DigitOrder, pad: PadPolicy) -> Self
pub fn new(dims: &[usize], order: DigitOrder, pad: PadPolicy) -> Self
Build the tensorization of a grid of shape dims.
Sourcepub fn tensor_len(&self) -> usize
pub fn tensor_len(&self) -> usize
Number of tensor entries (padded cells).
Sourcepub fn pad_grid(&self, data: &[f64]) -> Vec<f64>
pub fn pad_grid(&self, data: &[f64]) -> Vec<f64>
Mirror-pad data (shape dims) to the padded grid.
Sourcepub fn from_tensor(&self, tensor: &[f64]) -> Vec<f64>
pub fn from_tensor(&self, tensor: &[f64]) -> Vec<f64>
Tensor order → original grid (scatter + crop).
Trait Implementations§
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnsafeUnpin for Layout
impl UnwindSafe for Layout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more