Poplar and PopLibs
Convolution.hpp File Reference

Functions and data types to support performing convolutions. More...

#include "ConvParams.hpp"
#include <poplar/Graph.hpp>
#include <poplar/OptionFlags.hpp>
#include <poplar/Program.hpp>
#include <set>
#include <tuple>

Go to the source code of this file.

Classes

struct  poplin::PlanCosts
 Structure for estimated costs returned by reportPlanEstimatedCosts() More...
 

Namespaces

namespace  poplin
 Linear algebra functions.
 

Functions

uint64_t poplin::getFwdFlops (const ConvParams &params)
 Calculate the minimum number of floating point operations required to perform the forward pass convolution given a set of params.
 
uint64_t poplin::getBwdFlops (const ConvParams &params)
 Calculate the minimum number of floating point operations required to perform the backward pass convolution given a set of params.
 
uint64_t poplin::getWuFlops (const ConvParams &params)
 Calculate minimum number of floating point operations required to perform the weight update pass convolution given a set of params.
 
double poplin::getFwdPerfectCycleCount (const poplar::Graph &graph, const ConvParams &params)
 Calculate the number of cycles to perform the forward pass assuming maximal utilisation of target hardware performing the minimum number of floating point operations. More...
 
double poplin::getBwdPerfectCycleCount (const poplar::Graph &graph, const ConvParams &params)
 Calculate the number of cycles to perform the backward pass assuming maximal utilisation of the target hardware, performing the minimum number of floating point operations. More...
 
double poplin::getWuPerfectCycleCount (const poplar::Graph &graph, const ConvParams &params)
 Calculate the number of cycles to perform the weight update pass assuming maximal utilisation of the target hardware, performing the minimum number of floating point operations. More...
 
poplar::Tensor poplin::createWeights (poplar::Graph &graph, const ConvParams &params, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Create a weight tensor suitable for use with convolution() More...
 
poplar::Tensor poplin::createBiases (poplar::Graph &graph, const poplar::Tensor &activations, const poplar::DebugContext &debugContext={"biases"})
 Create a bias tensor suitable for input to the addBias() function. More...
 
poplar::Tensor poplin::createBiases (poplar::Graph &graph, const poplar::Tensor &activations, const ConvParams &params, const poplar::DebugContext &debugContext={"biases"}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Create a bias tensor suitable for input to the addBias() function with allocation consistent with plan parameters. More...
 
poplar::Tensor poplin::createInput (poplar::Graph &graph, const ConvParams &params, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Create an input tensor for a convolution. More...
 
poplar::Tensor poplin::createConvOutput (poplar::Graph &graph, const ConvParams &params, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Create an output tensor for a convolution. More...
 
poplar::Tensor poplin::convolution (poplar::Graph &graph, const poplar::Tensor &in, const poplar::Tensor &weights, const ConvParams &params, bool transposeAndFlipWeights, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Convolve an input with a set of weights. More...
 
void poplin::convolutionWithOutput (poplar::Graph &graph, const poplar::Tensor &in, const poplar::Tensor &weights, const poplar::Tensor &out, const ConvParams &params, bool transposeAndFlipWeights, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Convolve an input with a set of weights into a pre-allocated output tensor. More...
 
void poplin::preplanConvolutions (const std::set< ConvPlanParams > &convs, PlanningCache &cache)
 
void poplin::preplanConvolutions (poplar::Graph &graph, const std::set< ConvPlanParams > &convs, PlanningCache &cache)
 
void poplin::weightsTransposeChansFlipXY (poplar::Graph &graph, const poplar::Tensor &weightsIn, const poplar::Tensor &weightsOut, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={})
 Copy the weights in weightsIn into weightsOut such that each element of the kernel is transposed with respect to the input and output channels and flip each spatial dimension of the kernel. More...
 
poplar::Tensor poplin::calculateWeightDeltas (poplar::Graph &graph, const poplar::Tensor &zDeltas, const poplar::Tensor &activations, const ConvParams &params, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Append an operation to a poplar::Program to generate the tensor of weight deltas. More...
 
void poplin::convolutionWeightUpdate (poplar::Graph &graph, const poplar::Tensor &zDeltas, const poplar::Tensor &weights, const poplar::Tensor &activations, ConvParams params, const poplar::Tensor &scale, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Append operations to a poplar::Program to generate and apply the weight update. More...
 
void poplin::convolutionWeightUpdate (poplar::Graph &graph, const poplar::Tensor &zDeltas, const poplar::Tensor &weights, const poplar::Tensor &activations, ConvParams params, float scale, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Append operations to a poplar::Program to generate and apply the weight update. More...
 
void poplin::convolutionBiasUpdate (poplar::Graph &graph, const poplar::Tensor &zDeltas, const poplar::Tensor &biases, const poplar::Tensor &scale, const poplar::OptionFlags &options, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={})
 Add a program to update biases tensor with the gradients derived from the zDeltas tensor. More...
 
void poplin::convolutionBiasUpdate (poplar::Graph &graph, const poplar::Tensor &zDeltas, const poplar::Tensor &biases, float scale, const poplar::OptionFlags &options, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={})
 Add a program to update biases tensor with the gradients derived from the zDeltas tensor. More...
 
void poplin::addBias (poplar::Graph &graph, const poplar::Tensor &in, const poplar::Tensor &biases, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={})
 Adds a program to prog which adds biases to activations tensor. More...
 
void poplin::reportPlanInfo (std::ostream &out, const poplar::Graph &graph, const ConvParams &params, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Report the convolution plan corresponding to the params and options provided. More...
 
PlanCosts poplin::reportPlanEstimatedCosts (const poplar::Graph &graph, const ConvParams &params, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Report the estimated cycles and memory costs of the convolution plan corresponding to the params and options provided. More...
 
void poplin::reportWeightUpdatePlanInfo (std::ostream &out, const poplar::Graph &graph, const ConvParams &fwdParams, const poplar::OptionFlags &fwdOptions={}, PlanningCache *cache=nullptr)
 Report the convolution plan corresponding to the weight update pass given the forward pass params and options. More...
 
poplar::Tensor poplin::fullyConnectedWeightTranspose (poplar::Graph &graph, poplar::Tensor weights, const ConvParams &params, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
 Arranges the weights (activations) such that they are suited for the backward pass in a fully connected layer. More...
 
void poplin::convolutionValidateOptions (const poplar::OptionFlags &options)
 Provides an interface to validate the convolution options. More...
 

Detailed Description

Functions and data types to support performing convolutions.