Shortcuts

Struct InterpolateFuncOptions

Page Contents

Struct Documentation

struct torch::nn::functional::InterpolateFuncOptions

Options for torch::nn::functional::interpolate.

Example:

namespace F = torch::nn::functional;
F::interpolate(input, F::InterpolateFuncOptions().size(std::vector<int64_t>({4})).mode(torch::kNearest));

Public Types

typedef c10::variant<enumtype::kNearest, enumtype::kLinear, enumtype::kBilinear, enumtype::kBicubic, enumtype::kTrilinear, enumtype::kArea> mode_t

Public Functions

auto size(const c10::optional<std::vector<int64_t>> &new_size) -> decltype(*this)

output spatial sizes.

auto size(c10::optional<std::vector<int64_t>> &&new_size) -> decltype(*this)
const c10::optional<std::vector<int64_t>> &size() const noexcept
c10::optional<std::vector<int64_t>> &size() noexcept
auto scale_factor(const c10::optional<std::vector<double>> &new_scale_factor) -> decltype(*this)

multiplier for spatial size.

auto scale_factor(c10::optional<std::vector<double>> &&new_scale_factor) -> decltype(*this)
const c10::optional<std::vector<double>> &scale_factor() const noexcept
c10::optional<std::vector<double>> &scale_factor() noexcept
auto mode(const mode_t &new_mode) -> decltype(*this)

the upsampling algorithm: one of “nearest”, “linear”, “bilinear”, “bicubic”, “trilinear”, and “area”.

Default: “nearest”

auto mode(mode_t &&new_mode) -> decltype(*this)
const mode_t &mode() const noexcept
mode_t &mode() noexcept
auto align_corners(const c10::optional<bool> &new_align_corners) -> decltype(*this)

Geometrically, we consider the pixels of the input and output as squares rather than points.

If set to “True”, the input and output tensors are aligned by the center points of their corner pixels, preserving the values at the corner pixels. If set to “False”, the input and output tensors are aligned by the corner points of their corner pixels, and the interpolation uses edge value padding for out-of-boundary values, making this operation independent of input size when :attr:scale_factor is kept the same. This only has an effect when :attr:mode is “linear”, “bilinear”, “bicubic” or “trilinear”. Default: “False”

auto align_corners(c10::optional<bool> &&new_align_corners) -> decltype(*this)
const c10::optional<bool> &align_corners() const noexcept
c10::optional<bool> &align_corners() noexcept
auto recompute_scale_factor(const c10::optional<bool> &new_recompute_scale_factor) -> decltype(*this)

recompute the scale_factor for use in the interpolation calculation.

When scale_factor is passed as a parameter, it is used to compute the output_size. If recompute_scale_factor is true or not specified, a new scale_factor will be computed based on the output and input sizes for use in the interpolation computation (i.e. the computation will be identical to if the computed output_size were passed-in explicitly). Otherwise, the passed-in scale_factor will be used in the interpolation computation. Note that when scale_factor is floating-point, the recomputed scale_factor may differ from the one passed in due to rounding and precision issues.

auto recompute_scale_factor(c10::optional<bool> &&new_recompute_scale_factor) -> decltype(*this)
const c10::optional<bool> &recompute_scale_factor() const noexcept
c10::optional<bool> &recompute_scale_factor() noexcept

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources