8#ifndef poputil_VarStructure_hpp
9#define poputil_VarStructure_hpp
13#include <unordered_set>
16#include <poplar/Graph.hpp>
78 const std::vector<std::size_t> &shape,
79 const std::vector<std::size_t> &nPartitions,
99 const poplar::Tensor &t,
const std::vector<std::size_t> &nPartitions,
100 const std::function<
void(
const std::vector<std::size_t> &i,
DebugContext gathers the common external parameters of the context of an operation.
Definition: DebugContext.hpp:221
This class represents a graph program to be executed on the IPU.
Definition: Graph.hpp:52
A reference to a subset of tensor elements.
Definition: Tensor.hpp:38
Class representing device data types.
Definition: Type.hpp:42
General utility functions for building graphs.
Definition: GfloatExprUtil.hpp:23
std::pair< unsigned, unsigned > GroupingInfo
Grouped dimension info.
Definition: VarStructure.hpp:35
std::vector< GroupingInfo > detectDimGroupings(const poplar::Graph &graph, const poplar::Tensor &t)
Find all grouped dimensions from the innermost grouped dimension moving outwards, returning groupings...
unsigned detectInnermostGrouping(const poplar::Graph &graph, const poplar::Tensor &t)
Detect if the tensor t has a grouping in its innermost dimension.
void iterateTensorPartitions(const poplar::Tensor &t, const std::vector< std::size_t > &nPartitions, const std::function< void(const std::vector< std::size_t > &i, const poplar::Tensor &s)> &f)
Iterate a function over the partitions of a tensor.
poplar::Tensor createPartitionableTensor(poplar::Graph &graph, const poplar::Type &type, const std::vector< std::size_t > &shape, const std::vector< std::size_t > &nPartitions, const poplar::DebugContext &debugContext={})
Create a tensor with the given shape, so that when it is partitioned into slices according to the giv...