Template Struct ConstantPadOptions

Page Contents

Struct Documentation

template<size_t D>
struct torch::nn::ConstantPadOptions

Options for a D-dimensional ConstantPad module.

Public Functions

ConstantPadOptions(ExpandingArray<D * 2> padding, double value)
auto padding(const ExpandingArray<D * 2> &new_padding) -> decltype(*this)

The size of the padding.

  • If it is int, uses the same padding in all boundaries.

  • If it is a 2-tuple (for ConstantPad1d), uses (padding_left, padding_right).

  • If it is a 4-tuple (for ConstantPad2d), uses (padding_left, padding_right, padding_top, padding_bottom).

  • If it is a 6-tuple (for ConstantPad3d), uses (padding_left, padding_right, padding_top, padding_bottom, padding_front, padding_back).

auto padding(ExpandingArray<D * 2> &&new_padding) -> decltype(*this)
const ExpandingArray<D * 2> &padding() const noexcept
ExpandingArray<D * 2> &padding() noexcept
auto value(const double &new_value) -> decltype(*this)

Fill value for constant padding.

auto value(double &&new_value) -> decltype(*this)
const double &value() const noexcept
double &value() noexcept


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources