ConvParams

#include <poplin/ConvParams.hpp>

Data types for convolution parameters.

template<>
struct hash<poplin::ConvParams::InputTransform>

Public Functions

std::size_t operator()(const poplin::ConvParams::InputTransform &it) const
template<>
struct hash<poplin::ConvParams::OutputTransform>

Public Functions

std::size_t operator()(const poplin::ConvParams::OutputTransform &ot) const
template<>
struct hash<poplin::ConvParams>

Public Functions

std::size_t operator()(const poplin::ConvParams &params) const
namespace poplin

Linear algebra functions.

Decomposition of a matrix into an lower triangular matrix L and upper triangular matrix U.

Functions

std::ostream &operator<<(std::ostream &os, const ConvParams &p)
std::istream &operator>>(std::istream &is, ConvParams &p)
std::size_t hash_value(const ConvParams::InputTransform &it)
std::size_t hash_value(const ConvParams::OutputTransform &ot)
struct ConvParams

Public Functions

ConvParams() = default
ConvParams(poplar::Type dataType, std::size_t batchSize, std::vector<std::size_t> inputFieldShape, std::vector<std::size_t> kernelShape, std::size_t inputChannels, std::size_t outputChannels, std::size_t numConvGroups)
ConvParams(poplar::Type inputType, poplar::Type outputType, std::size_t batchSize, std::vector<std::size_t> inputFieldShape, std::vector<std::size_t> kernelShape, std::size_t inputChannels, std::size_t outputChannels, std::size_t numConvGroups)
ConvParams(poplar::Type inputType, poplar::Type outputType, std::size_t batchSize, std::vector<std::size_t> inputFieldShape, std::vector<std::size_t> kernelShape, std::size_t inputChannels, std::size_t outputChannels, std::size_t numConvGroups, InputTransform inputTransform, InputTransform kernelTransform, OutputTransform outputTransform)
std::size_t getUntransformedOutputSize(unsigned dim) const

Return the size of the output of the convolution operation, before output transformations are applied.

std::size_t getOutputSize(unsigned dim) const

Return the size of the output.

inline std::size_t getNumOutputChansPerConvGroup() const

Return the number of output channels per group.

inline std::size_t getNumOutputChans() const

Return the number of output channels.

inline std::size_t getInputSize(unsigned dim) const

Return the input size.

inline std::size_t getNumInputChansPerConvGroup() const

Return the number of input channels per group.

inline std::size_t getNumInputChans() const

Return the number of input channels per group.

inline std::size_t getNumConvGroups() const

Return the number of convolution groups.

inline std::size_t getNumFieldDims() const

Return the number of dimensions of the input field.

inline std::vector<std::size_t> getInputFieldShape() const

Return the shape of the input field.

inline std::vector<std::size_t> getKernelShape() const

Return the shape of the kernel.

inline std::size_t getBatchSize() const

Return the batch size.

unsigned getTruncatedInputSize(unsigned dim) const

Return the size of input in the specified dimension after truncation.

unsigned getTruncatedKernelSize(unsigned dim) const

Return the size of kernel in the specified dimension after truncation.

unsigned getTransformedInputSize(unsigned dim) const

Return the size of input in the specified dimension after applying the input transforms.

unsigned getTransformedKernelSize(unsigned dim) const

Return the size of kernel in the specified dimension after applying the kernel transforms.

std::vector<size_t> getOutputFieldShape() const

Returns the shape of the output field.

void validate() const
ConvParams canonicalize() const

Public Members

poplar::Type inputType
poplar::Type outputType
std::size_t batchSize

Batch size (B).

std::vector<std::size_t> inputFieldShape

Input field shape for each channel in a batch.

std::vector<std::size_t> kernelShape

Kernel shape for each channel.

std::size_t inputChannelsPerConvGroup

Input channels per conv group (Ci).

std::size_t outputChannelsPerConvGroup

Output channels per group (Co).

std::size_t numConvGroups

Number of groups in a grouped convolution (G).

The input and output channels are divided by G such that G kernels are applied to an input tensors of size [B, O{dims}, Ci/G] to produce output tensors of size [B, O{dims}, Co/G]. O{dims} is the output field dimensions.

InputTransform inputTransform

The transform applied to the input.

InputTransform kernelTransform

The transform applied to the kernel.

OutputTransform outputTransform

The transform applied to the output.

Friends

friend bool operator<(const ConvParams &a, const ConvParams &b)
friend bool operator==(const ConvParams &a, const ConvParams &b)
friend bool operator!=(const ConvParams &a, const ConvParams &b)
struct InputTransform

Public Functions

InputTransform() = default
InputTransform(const std::size_t size)
InputTransform(std::vector<unsigned> truncationLower, std::vector<unsigned> truncationUpper, std::vector<unsigned> dilation, std::vector<unsigned> paddingLower, std::vector<unsigned> paddingUpper, std::vector<bool> flip)
Parameters
  • truncationLower – Where to truncate the lower end of each dimension.

  • truncationUpper – Where to truncate the upper end of each dimension.

  • dilation – Dilation to apply to each dimension.

  • paddingLower – How much to pad the lower end of each dimension.

  • paddingUpper – How much to pad the upper end of each dimension.

  • flip – If true, each spatial dimension is flipped after being padded.

Public Members

std::vector<unsigned> truncationLower

The position where the lower end of each spatial dimension is truncated before dilation.

std::vector<unsigned> truncationUpper

The position where the upper end of each spatial dimension is truncated before dilation.

std::vector<unsigned> dilation

Dilation applied to each spatial dimensions after truncation and before padding.

Dilation is performed by placing a number of zeroed elements between the elements of the field.

std::vector<unsigned> paddingLower

Padding applied to each spatial dimension after dilation and before flipping.

std::vector<unsigned> paddingUpper

Padding applied to each spatial dimension after dilation and before flipping.

std::vector<bool> flip

If true, each spatial dimension is flipped after being padded.

Friends

friend bool operator<(const InputTransform &a, const InputTransform &b)
friend bool operator==(const InputTransform &a, const InputTransform &b)
friend bool operator!=(const InputTransform &a, const InputTransform &b)
struct OutputTransform

Public Functions

OutputTransform() = default
OutputTransform(const std::size_t size)
OutputTransform(std::vector<unsigned> truncationLower, std::vector<unsigned> truncationUpper, std::vector<unsigned> striding, std::vector<unsigned> paddingLower, std::vector<unsigned> paddingUpper)
Parameters
  • truncationLower – Where to truncate the lower end of each dimension.

  • truncationUpper – Where to truncate the upper end of each dimension.

  • striding – Stride to use in convolution.

  • paddingLower – How much to pad the lower end of each dimension.

  • paddingUpper – How much to pad the upper end of each dimension.

Public Members

std::vector<unsigned> truncationLower

The position where the lower end of each spatial dimension is truncated before dilation.

std::vector<unsigned> truncationUpper

The position where the upper end of each spatial dimension is truncated before dilation.

std::vector<unsigned> stride

Striding applied to each spatial dimension after truncation and before padding.

std::vector<unsigned> paddingLower

Padding applied to lower end of each spatial dimension after striding.

std::vector<unsigned> paddingUpper

Padding applied to upper end of each spatial dimension after striding.

Friends

friend bool operator<(const OutputTransform &a, const OutputTransform &b)
friend bool operator==(const OutputTransform &a, const OutputTransform &b)
friend bool operator!=(const OutputTransform &a, const OutputTransform &b)
namespace std
template<> ConvParams >

Public Functions

std::size_t operator()(const poplin::ConvParams &params) const
template<> InputTransform >

Public Functions

std::size_t operator()(const poplin::ConvParams::InputTransform &it) const
template<> OutputTransform >

Public Functions

std::size_t operator()(const poplin::ConvParams::OutputTransform &ot) const