Poplar and PopLibs
|
Functions for pooling operations. More...
Functions | |
poplar::Tensor | pool (poplar::Graph &graph, const PoolParams ¶ms, const poplar::Tensor &in, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}) |
Add a pooling operation to the graph. More... | |
poplar::Tensor | poolInputGradient (poplar::Graph &graph, const PoolParams ¶ms, const poplar::Tensor &in, const poplar::Tensor &pooled, const poplar::Tensor &pooledGradient, bool useScaledGradient, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}) |
Calculate the gradient with respect to the input of a pooling operation given the gradient of the output. More... | |
poplar::Tensor | poolInputGradient (poplar::Graph &graph, const PoolParams ¶ms, const unsigned fwdChansPerGroup, const poplar::Tensor &pooledGradient, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}) |
Calculate the gradient with respect to the input of a pooling operation given the gradient of the output. More... | |
Functions for pooling operations.
poplar::Tensor popnn::pooling::pool | ( | poplar::Graph & | graph, |
const PoolParams & | params, | ||
const poplar::Tensor & | in, | ||
poplar::program::Sequence & | prog, | ||
const poplar::DebugContext & | debugContext = {} , |
||
const poplar::OptionFlags & | options = {} |
||
) |
Add a pooling operation to the graph.
This performs a pooling over the spatial dimensions [...]. The shape of the input should be [batchSize * numChannels * ...
].
graph | The graph that the operation will be added to. |
params | The pooling parameters. |
in | The input tensor. |
prog | The program sequence to append the operation to. |
debugContext | Optional debug information. |
options | Pooling options (not currently used). |
poplar::Tensor popnn::pooling::poolInputGradient | ( | poplar::Graph & | graph, |
const PoolParams & | params, | ||
const poplar::Tensor & | in, | ||
const poplar::Tensor & | pooled, | ||
const poplar::Tensor & | pooledGradient, | ||
bool | useScaledGradient, | ||
poplar::program::Sequence & | prog, | ||
const poplar::DebugContext & | debugContext = {} , |
||
const poplar::OptionFlags & | options = {} |
||
) |
Calculate the gradient with respect to the input of a pooling operation given the gradient of the output.
While this function can be used for maximum, average or sum pooling, poolInputGradient(poplar::Graph&, const PoolParams&, const unsigned, const poplar::Tensor&, poplar::program::Sequence&, const poplar::DebugContext&, const poplar::OptionFlags&) is recommended for average or sum pooling.
This performs a pooling over the spatial dimensions [...]. The shape of the input should be [batchSize * numChannels * ...
].
graph | The graph the operation will be added to. |
params | The pooling parameters. |
in | The forward activations tensor input to pooling. |
pooled | The output of pooling in the forward pass. |
pooledGradient | The gradients to the pooling operation. |
useScaledGradient | Use a scaled gradient if set to true. Otherwise, the gradient is propagated to all the positions which matched the pooled value in the forward pass. |
prog | The program sequence to append the operation to. |
debugContext | Optional debug information. |
options | The pooling options. See pool(). |
poplar::Tensor popnn::pooling::poolInputGradient | ( | poplar::Graph & | graph, |
const PoolParams & | params, | ||
const unsigned | fwdChansPerGroup, | ||
const poplar::Tensor & | pooledGradient, | ||
poplar::program::Sequence & | prog, | ||
const poplar::DebugContext & | debugContext = {} , |
||
const poplar::OptionFlags & | options = {} |
||
) |
Calculate the gradient with respect to the input of a pooling operation given the gradient of the output.
This function should be used for average and sum pooling.
This performs a pooling over the spatial dimensions [...]. The shape of the output will be [batchSize * numChannels * ...
].
graph | The graph the operation will be added to. |
params | The pooling parameters. |
fwdChansPerGroup | Used in creating the output tensor. |
pooledGradient | The gradients to the pooling operation. |
prog | The program sequence to append the operation to. |
debugContext | Optional debug information. |
options | The pooling options. See pool(). |