TensorRearranger

#include <poplar/TensorRearranger.hpp>
namespace poplar

Poplar classes and functions.

A VectorList is a list of vectors with a specific layout and with the usage semantics of a 2D vector.

A 1D vector must be laid out in a contiguous memory region. A 2D vector is a vector of 1D vectors. Each of these 1D vectors that make up a 2D vector is called a “sub-vector” for the remainder of this document. The elements of a 2D vector can be accessed by indexing the 2D vector along the outer and inner dimensions as A[outer][inner].

The following two categories of layouts are supported:

  1. VectorListLayout::DELTANELEMENTS is a memory efficient 2D vector layout. For legacy systems VectorListLayout::DELTAN served a similar purpose. Each sub-vector must be laid out as a contiguous memory region but the sub-vectors may may not be laid out contiguous with respect to each other in memory. Each sub-vector may have a different length.

  2. VectorListLayout::ONE_PTR and other VectorListLayout layouts that are prefixed by SCALED_PTR are for Poplar runtime use only.

class TensorRearranger
#include <TensorRearranger.hpp>

TensorRearranger can be used to re-order the view on a tensor and to undo that re-ordering.

Public Functions

TensorRearranger()
TensorRearranger(const TensorRearranger &other)
TensorRearranger(TensorRearranger &&other) noexcept
TensorRearranger &operator=(const TensorRearranger &other) &
TensorRearranger &operator=(TensorRearranger &&other) & noexcept
~TensorRearranger()
Tensor rearrange(const Tensor &t) const

Rearrange a tensor.

Tensor undoRearrangement(const Tensor &t) const

Undo the rearrangement done with the rearrange() method.

std::vector<Interval> rearrange(ArrayRef<Interval> is) const

Rearrange intervals.

Parameters

is – A list of intervals from the original tensor.

Returns

A list of equivalent intervals from the rearranged tensor.

std::vector<Interval> undoRearrangement(ArrayRef<Interval> is) const

Undo the rearrangement of intervals.

Parameters

is – A list of intervals from the rearranged tensor.

Returns

A list of equivalent intervals from the original tensor.

TensorRearranger(std::unique_ptr<core::TensorRearranger>)
inline core::TensorRearranger &getImpl() const
inline std::unique_ptr<core::TensorRearranger> *getPImpl()
inline bool valid() const

Private Members

std::unique_ptr<core::TensorRearranger> impl
namespace core