Poplar and PopLibs
|
Information about a vertex field, including its size and its initial value, if set. More...
#include <VertexIntrospector.hpp>
Public Member Functions | |
unsigned | rank () const |
Return the rank of the field. More... | |
std::size_t | size () const |
Determine the size of the field. More... | |
std::size_t | getSizeAtIndex (std::size_t i) const |
Determine the size of the sub-vector for 2D fields. More... | |
layout::Vector | getProfilerVectorLayout (std::size_t nestingLevel) const |
Determine the layout for vector fields. More... | |
layout::VectorList | getProfilerVectorListLayout () const |
For VectorList fields, return the layout. More... | |
SizeT | operator[] (std::size_t i) const |
Determine size of field. More... | |
std::string | name () const |
Return the name of the vertex field. | |
template<typename T > | |
T | getInitialValue (const Target &target) const |
Get the inital value for a scalar field. More... | |
template<typename T > | |
std::vector< T > | getInitialValues (const Target &target) const |
Get the initial value for a 1D or 2D vector field. More... | |
Information about a vertex field, including its size and its initial value, if set.
This is used when calculating cycle estimates.
Vertex fields can be scalar, 1D or 2D. For example:
float
, Input<float>
.Vector<float>
, Input<Vector<float>>
Input<VectorList<float>>
, Vector<Input<Vector<float>>>
The sizes of vertex fields can always be returned, and the initial values can be returned for non-edge fields (float
, Vector<float>
) and edge fields (Input
and so on) that are connected to constants.
Note that 2D fields are vectors of vectors, in other words they are jagged 2D arrays.
|
inline |
Get the inital value for a scalar field.
T
must be of type scalar. Throws an error if this is not a scalar field.
|
inline |
Get the initial value for a 1D or 2D vector field.
For 1D fields, T
should be a scalar type (for example, float
) and for 2D fields, T
should be std::vector<>
. Throws an error if this is a scalar field.
layout::Vector poplar::FieldData::getProfilerVectorLayout | ( | std::size_t | nestingLevel | ) | const |
Determine the layout for vector fields.
i | The dimension to query, 0 for the outer vector, 1 for the inner. |
layout::VectorList poplar::FieldData::getProfilerVectorListLayout | ( | ) | const |
For VectorList fields, return the layout.
We only support introspecting a VectorList that is the outermost vector.
std::size_t poplar::FieldData::getSizeAtIndex | ( | std::size_t | i | ) | const |
Determine the size of the sub-vector for 2D fields.
Throws an error if called on non-2D fields.
i | Index of the sub-vector in the 2D field. |
|
inline |
Determine size of field.
This is an alternate to getSizeAtIndex(). Instead of field.getSizeAtIndex(i)
you can use field[i].size()
.
unsigned poplar::FieldData::rank | ( | ) | const |
Return the rank of the field.
std::size_t poplar::FieldData::size | ( | ) | const |
Determine the size of the field.