Fill

#include <popops/Fill.hpp>

Functions to fill tensors with values.

Supported fillValue types are FLOAT, HALF, INT and UNSIGNED_INT.

namespace popops

Common functions, such as elementwise and reductions.

Functions

template<typename FillValueType>
void fill(poplar::Graph &graph, poplar::Tensor t, const std::vector<poplar::Interval> &tileRegions, unsigned tile, poplar::ComputeSet fillCS, FillValueType fillValue)

Appends vertices to fillCS which fills elements in tileRegions of t which reside on tile tile.

Parameters
  • graph – The graph that the operation will be added to.

  • t – The tensor whose elements are to be set to zero.

  • tileRegions – Region mapping of the tensor on tile.

  • tile – Tile which the regions relate to.

  • fillCS – Compute set to add the operation into.

  • fillValue – The value to fill t with.

template<typename FillValueType>
void fill(poplar::Graph &graph, const poplar::Tensor &t, unsigned tile, poplar::ComputeSet fillCS, FillValueType fillValue)

Appends vertices to fillCS which fills all elements of t which reside on tile tile.

Parameters
  • graph – The graph that the operation will be added to.

  • t – The tensor whose elements are to be set to zero.

  • tile – Tile on which the tensor is mapped to.

  • fillCS – Compute set to add the operation into.

  • fillValue – The value to fill t with.

template<typename FillValueType>
void fill(poplar::Graph &graph, const poplar::Tensor &t, const std::vector<std::vector<poplar::Interval>> &mapping, poplar::ComputeSet fillCS, FillValueType fillValue)

Appends vertices to fillCS which fills elements in mapping of t which reside on tiles represented with mapping.

Parameters
  • graph – The graph that the operation will be added to.

  • t – The tensor whose elements are to be set to zero.

  • mapping – The tensor’s region mapping per tile. Each element describes a region mapping of a tile (ordered). That is, mapping[0] is the region of t mapped onto tile 0.

  • fillCS – Compute set to add the operation into.

  • fillValue – The value to fill t with.

template<typename FillValueType>
void fill(poplar::Graph &graph, const poplar::Tensor &t, poplar::program::Sequence &prog, FillValueType fillValue, const poplar::DebugContext &debugContext = {})

Appends programs to prog which fills all elements of the tensor t with a value of fillValue.

Note

The type of fillValue must be compatible with the element type of t.

Parameters
  • graph – The graph that the operation will be added to.

  • t – The tensor whose elements are to be filled.

  • prog – Poplar program sequence to append the operation onto.

  • fillValue – The value to fill t with.

  • debugContext – Optional debug information.