Struct primitiv::Shape
[−]
[src]
pub struct Shape { /* fields omitted */ }
Data structure to represent the shape of the node.
Methods
impl Shape
[src]
pub fn new() -> Self
[src]
Creates a new scalar Shape object.
pub fn from_dims(dims: &[u32], batch: u32) -> Self
[src]
Creates a new Shape object.
pub fn at(&self, i: u32) -> u32
[src]
Returns the size of the i-th dimension.
pub fn dims(&self) -> Vec<u32>
[src]
Returns the dimension array.
pub fn depth(&self) -> u32
[src]
Returns the depth (length of non-1 dimensions) of the shape.
pub fn batch(&self) -> u32
[src]
Returns the batch size.
pub fn volume(&self) -> u32
[src]
Returns the number of elements in each sample. This value is equal to the product of all dimensions.
pub fn lower_volume(&self, dim: u32) -> u32
[src]
Returns the number of elements in 1 to specified dim.
pub fn size(&self) -> usize
[src]
Returns the number of elements in all samples of the mini-batch. This value is equal to batch() * volume().
pub fn has_batch(&self) -> bool
[src]
Checks whether the shape has minibatch or not.
pub fn has_compatible_batch(&self, other: &Shape) -> bool
[src]
Checks whether two batch size is compatible (broadcastable) or not.
pub fn is_scalar(&self) -> bool
[src]
Checks whether the shape is a scalar or not.
pub fn is_column_vector(&self) -> bool
[src]
Checks whether the shape is a column vector or not.
pub fn is_matrix(&self) -> bool
[src]
Checks whether the shape is a vector or a matrix, or not.
pub fn has_same_dims(&self, other: &Shape) -> bool
[src]
Checks whether two shapes have completely same dimensions.
pub fn has_same_loo_dims(&self, other: &Shape, dim: u32) -> bool
[src]
Checks whether two shapes have same dimensions without an axis. (LOO: leave one out)
pub fn resize_dim(&self, dim: u32, m: u32) -> Shape
[src]
Creates a new shape which have one different dimension.
pub fn resize_batch(&self, batch: u32) -> Shape
[src]
Creates a new shape which have specified batch size.
pub fn update_dim(&mut self, dim: u32, m: u32)
[src]
Directly updates a specified dimension.
pub fn update_batch(&mut self, batch: u32)
[src]
Directly updates the batch size.
Trait Implementations
impl Debug for Shape
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Wrap<primitivShape_t> for Shape
[src]
fn from_raw(ptr: *mut primitivShape_t, _owned: bool) -> Self
[src]
fn as_ptr(&self) -> *const primitivShape_t
[src]
fn as_mut_ptr(&mut self) -> *mut primitivShape_t
[src]
fn is_owned(&self) -> bool
[src]
impl Drop for Shape
[src]
impl Clone for Shape
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
[src]
Performs copy-assignment from source
. Read more
impl PartialEq for Shape
[src]
fn eq(&self, other: &Shape) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Eq for Shape
[src]
impl Display for Shape
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more