Poplar and PopLibs
Rnn.hpp File Reference

Functions for recurrent neural networks (RNN). More...

#include <cassert>
#include <cstdint>
#include <poplar/Graph.hpp>
#include <poplar/Program.hpp>
#include <poplar/Tensor.hpp>
#include <poputil/DebugInfo.hpp>

Go to the source code of this file.

Classes

struct  popnn::rnn::RnnParams
 Structure of Recurrent Neural Network (RNN) parameters which allows for any customized implementation of the cellular part of the RNN. More...
 
struct  popnn::rnn::RnnSlice
 Tensors required for processing a single time step. More...
 
struct  popnn::rnn::StateSequence
 Structure that associates a particular state tensor with a user-defined output tensor. More...
 

Namespaces

namespace  popnn
 Functions used in neural networks.
 
namespace  popnn::rnn
 Functions for Recurrent Neural Networks (RNN)
 

Typedefs

using popnn::rnn::LoopBodyType = std::function< poplar::program::Sequence(poplar::Graph &graph, const TimeStepState &time, const RnnBatchwiseFlags &, std::vector< poplar::Tensor > &, const RnnSlice &slice, std::vector< poplar::Tensor > &, poplar::program::Sequence *, const poplar::DebugNameAndId &)>
 Create loop body function for the given shard. More...
 
using popnn::rnn::GatherBodyType = std::function< poplar::program::Sequence(poplar::Graph &graph, const RnnSlice &slice, unsigned stepsPerGather, poplar::program::Sequence *, const poplar::DebugNameAndId &)>
 Create gather body function for the given shard. More...
 

Functions

poplar::Tensor popnn::rnn::createInitialState (poplar::Graph &graph, const RnnParams &params, bool isOutput, unsigned multiple, unsigned numShards, const poplar::DebugContext &debugContext={})
 Create state tensor to be used in all recurrences of the RNN. More...
 
poplar::Tensor popnn::rnn::createRecurrentTensor (poplar::Graph &graph, const RnnParams &params, unsigned size, unsigned numShards, const poplar::DebugContext &debugContext={})
 Create recurrent tensor of shape [timeSteps, batchSize, size] suitable for slicing and/or sharding of the outermost dimension. More...
 
poplar::Tensor popnn::rnn::createInputTensor (poplar::Graph &graph, const RnnParams &params, unsigned numShards, const poplar::DebugContext &debugContext={})
 Create input tensor of shape [timeSteps, batchSize, inputSize] suitable for slicing and/or sharding of the outermost dimension. More...
 
poplar::Tensor popnn::rnn::createOutputTensor (poplar::Graph &graph, const RnnParams &params, unsigned numShards, const poplar::DebugContext &debugContext={})
 Create a standard output tensor of shape [timeSteps, batchSize, outputSize] suitable for slicing and/or sharding of the outermost dimension. More...
 
poplar::Tensor popnn::rnn::createOutputTensor (poplar::Graph &graph, const RnnParams &params, unsigned multiple, unsigned numShards, const poplar::DebugContext &debugContext={})
 Create a single output tensor with multiple (standard) output tensors concatenated along the outermost (timeSteps) dimension. More...
 
poplar::Tensor popnn::rnn::shiftRnnTensor (poplar::Graph &graph, const RnnParams &params, const poplar::Tensor &tBase, const poplar::Tensor &tSingle, poplar::program::Sequence &prog, unsigned numShards, const poplar::DebugContext &debugContext={})
 Create a single-step shifted RNN tensor from an input tensor. More...
 
std::vector< poplar::Tensorpopnn::rnn::Rnn (poplar::Graph &graph, const RnnParams &params, bool reverse, const std::vector< poplar::Tensor > &initState, const StateSequence &stateSequence, const std::vector< poplar::Tensor > &inputs, const poplar::Tensor *interimIn, poplar::Tensor *interimOut, const std::vector< poplar::Tensor > &outputs, const std::vector< poplar::Tensor > &created, poplar::program::Sequence &prog, const LoopBodyType &loopFn, unsigned numShards, poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
 Run custom Recurrent Neural Net cell implementation recurrently. More...
 
std::vector< poplar::Tensorpopnn::rnn::Rnn (poplar::Graph &graph, const RnnParams &params, const std::vector< poplar::Tensor > &initState, const StateSequence &stateSequence, const std::vector< poplar::Tensor > &inputs, const poplar::Tensor &interimIn, const unsigned numTemps, poplar::program::Sequence &prog, const LoopBodyType &loopFn, const std::vector< poplar::Tensor > &gatherInputs, const GatherBodyType &gatherFn, unsigned numShards, unsigned stepsPerGather, poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
 Run custom Recurrent Neural Net cell callback at every time step in decrementing order. More...
 

Detailed Description

Functions for recurrent neural networks (RNN).