10#ifndef poplin_ConvUtil_hpp
11#define poplin_ConvUtil_hpp
25unsigned getInputIndex(
unsigned dim,
unsigned outputIndex,
unsigned kernelIndex,
26 const ConvParams ¶ms);
31unsigned getKernelIndex(
unsigned dim,
unsigned outputIndex,
unsigned inputIndex,
32 const ConvParams ¶ms);
36std::pair<unsigned, unsigned>
38 std::pair<unsigned, unsigned> outputRange,
39 unsigned kernelIndex,
const ConvParams ¶ms);
43std::pair<unsigned, unsigned>
45 std::pair<unsigned, unsigned> outputRange,
46 unsigned inputIndex,
const ConvParams ¶ms);
51 unsigned dim, std::pair<unsigned, unsigned> outputRange,
52 std::pair<unsigned, unsigned> kernelIndexRange,
const ConvParams ¶ms);
57 unsigned dim, std::pair<unsigned, unsigned> outputRange,
58 std::pair<unsigned, unsigned> inputRange,
const ConvParams ¶ms);
62std::pair<unsigned, unsigned>
64 unsigned kernelIndex,
const ConvParams ¶ms);
68std::pair<unsigned, unsigned>
70 unsigned inputIndex,
const ConvParams ¶ms);
74std::pair<unsigned, unsigned>
76 std::pair<unsigned, unsigned> kernelIndexRange,
77 const ConvParams ¶ms);
81std::pair<unsigned, unsigned>
83 std::pair<unsigned, unsigned> inputRange,
84 const ConvParams ¶ms);
86inline std::pair<unsigned, unsigned>
88 std::pair<unsigned, unsigned> kernelIndexRange,
89 const ConvParams ¶ms) {
90 return getInputRange(dim, {outputIndex, outputIndex + 1}, kernelIndexRange,
94inline std::pair<unsigned, unsigned>
95getInputRange(
unsigned dim,
unsigned outputIndex,
const ConvParams ¶ms) {
96 return getInputRange(dim, outputIndex, {0, params.kernelShape[dim]}, params);
99inline std::pair<unsigned, unsigned>
100getInputRange(
unsigned dim, std::pair<unsigned, unsigned> outputRange,
101 const ConvParams ¶ms) {
102 return getInputRange(dim, outputRange, {0, params.kernelShape[dim]}, params);
Functions and data types to support performing convolutions.
Linear algebra functions.
Definition: Cholesky.hpp:14
ConvParams getGradientParams(const ConvParams ¶ms)
Given a set of parameters, return the set of params that represent the convolution to be applied to t...
std::pair< unsigned, unsigned > getOutputRangeForKernelRange(unsigned dim, std::pair< unsigned, unsigned > outputRange, std::pair< unsigned, unsigned > kernelIndexRange, const ConvParams ¶ms)
Given an output range, return the subset whose calculation involves the specified range of kernel ind...
unsigned getKernelIndex(unsigned dim, unsigned outputIndex, unsigned inputIndex, const ConvParams ¶ms)
Return the index of the kernel element that is multiplied by the specified input index to produce the...
std::pair< unsigned, unsigned > getOutputRangeForInputRange(unsigned dim, std::pair< unsigned, unsigned > outputRange, std::pair< unsigned, unsigned > inputRange, const ConvParams ¶ms)
Given an output range, return the subset whose calculation involves the specified range of input indi...
std::pair< unsigned, unsigned > getInputRange(unsigned dim, std::pair< unsigned, unsigned > outputRange, unsigned kernelIndex, const ConvParams ¶ms)
Return the input range that is associated with the specified kernel index when calculating the specif...
std::pair< unsigned, unsigned > getOutputRangeForInputIndex(unsigned dim, std::pair< unsigned, unsigned > outputRange, unsigned inputIndex, const ConvParams ¶ms)
Given an output range, return the subset whose calculation involves the specified input.
std::pair< unsigned, unsigned > getKernelRange(unsigned dim, std::pair< unsigned, unsigned > outputRange, unsigned inputIndex, const ConvParams ¶ms)
Return the kernel range that is associated with the specified input index when calculating the specif...
unsigned getInputIndex(unsigned dim, unsigned outputIndex, unsigned kernelIndex, const ConvParams ¶ms)
Return the index of the input element that is multiplied by the specified kernel index to produce the...
ConvParams getWeightUpdateParams(const ConvParams &fwdParams)
Given a set of convolution parameters, return the set of params that represent the convolution to be ...
std::pair< unsigned, unsigned > getOutputRangeForKernelIndex(unsigned dim, std::pair< unsigned, unsigned > outputRange, unsigned kernelIndex, const ConvParams ¶ms)
Given an output range, return the subset whose calculation involves the specified kernel index.
unsigned getDilatedSize(unsigned size, unsigned dilation)
Return the output size when the specified dilation is applied to an input of the specified size.