Class representing a dimension, which may be dynamic (undetermined until runtime), in a shape or shape-like object. More...
#include <dimension.hpp>
Public Types | |
| using | value_type = int64_t |
Public Member Functions | |
| Dimension (value_type dimension) | |
| Construct a static dimension. More... | |
| Dimension (value_type min_dimension, value_type max_dimension) | |
| Construct a dynamic dimension with bounded range. More... | |
| Dimension ()=default | |
| Construct a dynamic dimension with range [0, ...]. | |
| bool | operator== (const Dimension &dimension) const |
| bool | operator!= (const Dimension &dimension) const |
| bool | is_static () const |
| Check whether this dimension is static. More... | |
| bool | is_dynamic () const |
| Check whether this dimension is dynamic. More... | |
| value_type | get_length () const |
Convert this dimension to value_type. This dimension must be static and non-negative. More... | |
| value_type | get_min_length () const |
| value_type | get_max_length () const |
| const Interval & | get_interval () const |
| Return the interval of valid lengths. | |
| Interval & | get_interval () |
| bool | same_scheme (const Dimension &dim) const |
| Check whether this dimension represents the same scheme as the argument (both dynamic, or equal). More... | |
| bool | compatible (const Dimension &d) const |
| Check whether this dimension is capable of being merged with the argument dimension. More... | |
| bool | relaxes (const Dimension &d) const |
| Check whether this dimension is a relaxation of the argument. More... | |
| bool | refines (const Dimension &d) const |
| Check whether this dimension is a refinement of the argument. More... | |
| Dimension | operator+ (const Dimension &dim) const |
| Addition operator for Dimension. More... | |
| Dimension | operator- (const Dimension &dim) const |
| Subtraction operator for Dimension. More... | |
| Dimension | operator* (const Dimension &dim) const |
| Multiplication operator for Dimension. More... | |
| Dimension & | operator+= (const Dimension &dim) |
| Add-into operator for Dimension. More... | |
| Dimension & | operator*= (const Dimension &dim) |
| Multiply-into operator for Dimension. More... | |
| Dimension | operator& (const Dimension &dim) const |
| Intersection of dimensions. | |
| Dimension & | operator&= (const Dimension &dim) |
| Intersection of dimensions. | |
Static Public Member Functions | |
| static bool | merge (Dimension &dst, const Dimension d1, const Dimension d2) |
| Try to merge two Dimension objects together. More... | |
| static bool | broadcast_merge (Dimension &dst, const Dimension d1, const Dimension d2) |
| Try to merge two Dimension objects together with implicit broadcasting of unit-sized dimension to non unit-sized dimension. | |
| static Dimension | dynamic () |
| Create a dynamic dimension. More... | |
Class representing a dimension, which may be dynamic (undetermined until runtime), in a shape or shape-like object.
Static dimensions may be implicitly converted from value_type. A dynamic dimension is constructed with Dimension() or Dimension::dynamic().
| ngraph::Dimension::Dimension | ( | value_type | dimension | ) |
Construct a static dimension.
| dimension | Value of the dimension. |
| ngraph::Dimension::Dimension | ( | value_type | min_dimension, |
| value_type | max_dimension | ||
| ) |
Construct a dynamic dimension with bounded range.
| min_dimension | The lower inclusive limit for the dimension |
| mas_dimension | The upper inclusive limit for the dimension |
| bool ngraph::Dimension::compatible | ( | const Dimension & | d | ) | const |
Check whether this dimension is capable of being merged with the argument dimension.
| d | The dimension to compare this dimension with. |
true if this dimension is compatible with d, else false.Two dimensions are considered compatible if it is possible to merge them. (See Dimension::merge.)
|
inlinestatic |
Create a dynamic dimension.
| value_type ngraph::Dimension::get_length | ( | ) | const |
Convert this dimension to value_type. This dimension must be static and non-negative.
| std::invalid_argument | If this dimension is dynamic or negative. |
|
inline |
Check whether this dimension is dynamic.
false if the dimension is static, else true.
|
inline |
Check whether this dimension is static.
true if the dimension is static, else false.
|
static |
Try to merge two Dimension objects together.
| [out] | dst | Reference to write the merged Dimension into. |
| d1 | First dimension to merge. | |
| d2 | Second dimension to merge. |
true if merging succeeds, else false.d1 is dynamic, writes d2 to dst and returns true. d2 is dynamic, writes d1 to dst and returns true. d1 and d2 are static and equal, writes d1 to dst and returns true. d1 and d2 are both static and unequal, leaves dst unchanged and returns false. Multiplication operator for Dimension.
| dim | Right operand for multiplicaiton. |
this or dim has length 0, else unbounded if either is unbounded, else product of lengths. Multiply-into operator for Dimension.
| dim | Right operand for multiplication. |
*this, after updating *this to the value *this * dim. Addition operator for Dimension.
| dim | Right operand for addition. |
Add-into operator for Dimension.
| dim | Right operand for addition. |
*this, after updating *this to the value *this + dim. Subtraction operator for Dimension.
| dim | Right operand for subtraction. |
| bool ngraph::Dimension::refines | ( | const Dimension & | d | ) | const |
Check whether this dimension is a refinement of the argument.
| d | The dimension to compare this dimension with. |
true if this dimension relaxes d, else false.A dimension d2 refines (or is a refinement of) d1 if d1 and d2 are static and equal, or d2 is dynamic.
d1.refines(d2) is equivalent to d2.relaxes(d1).
| bool ngraph::Dimension::relaxes | ( | const Dimension & | d | ) | const |
Check whether this dimension is a relaxation of the argument.
| d | The dimension to compare this dimension with. |
true if this dimension relaxes d, else false.A dimension d1 relaxes (or is a relaxation of) d2 if d1 and d2 are static and equal, or d1 is dynamic.
d1.relaxes(d2) is equivalent to d2.refines(d1).
| bool ngraph::Dimension::same_scheme | ( | const Dimension & | dim | ) | const |
Check whether this dimension represents the same scheme as the argument (both dynamic, or equal).
| dim | The other dimension to compare this dimension to. |
true if this dimension and dim are both dynamic, or if they are both static and equal; otherwise, false.