Functions for padding a tensor.
More...
#include <poplar/Graph.hpp>
#include <poplar/Program.hpp>
#include <vector>
Go to the source code of this file.
|
namespace | popops |
| Common functions, such as elementwise and reductions.
|
|
|
poplar::Tensor | popops::pad (const poplar::Tensor &t, const std::vector< std::ptrdiff_t > &paddingLower, const std::vector< std::ptrdiff_t > &paddingUpper, padding::Type type) |
| Return a tensor with numpy-style padding added. More...
|
|
poplar::Tensor | popops::pad (const poplar::Tensor &t, std::ptrdiff_t paddingLower, std::ptrdiff_t paddingUpper, unsigned dim, padding::Type type) |
| Return a tensor with numpy-style padding added to one dimension. More...
|
|
|
poplar::Tensor | popops::pad (poplar::Graph &graph, const poplar::Tensor &t, const std::vector< std::ptrdiff_t > &paddingLower, const std::vector< std::ptrdiff_t > &paddingUpper, float val=0.0f, padding::MappingMethod mappingMethod=padding::MappingMethod::ZERO) |
| Return a tensor with constant padding added. More...
|
|
|
poplar::Tensor | popops::pad (poplar::Graph &graph, const poplar::Tensor &t, std::ptrdiff_t paddingLower, std::ptrdiff_t paddingUpper, unsigned dim, float val=0.0f, padding::MappingMethod mappingMethod=padding::MappingMethod::ZERO) |
| Return a tensor with constant padding added to one dimension. More...
|
|
Functions for padding a tensor.
◆ MappingMethod
Methods to map added padding elements to tiles.
Enumerator |
---|
NONE | Padding won't be mapped.
|
ZERO | Set tile mapping of padding element to tile 0 for the graph.
|
EDGE | Set tile mapping of padding elements to match the nearest-neighbour element which lies on the edge of the tensor prior to padding.
Requires a non-empty tensor to be padded with a complete tile mapping.
|
◆ Type
Padding types as per numpy.pad.
Enumerator |
---|
EDGE | Also known as nearest-neighbour padding, each new pad element has its value set to that of the pre-padded element nearest to it.
Any such nearest neighbour lies on the edge of the pre-padded tensor, hence the name.
|
REFLECT | The tensor is reflected outwards.
Specifically, a new pad element has its value set to that of the element which is an equal distance to the pad element's nearest neighbour as the pad element, but in the opposite direction.
|