Struct InterpolateFuncOptions¶
Defined in File upsampling.h
Page Contents
Struct Documentation¶
-
struct 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 std::variant<enumtype::kNearest, enumtype::kLinear, enumtype::kBilinear, enumtype::kBicubic, enumtype::kTrilinear, enumtype::kArea, enumtype::kNearestExact> mode_t¶
Public Functions
-
inline auto size(const std::optional<std::vector<int64_t>> &new_size) -> decltype(*this)¶
output spatial sizes.
-
inline auto size(std::optional<std::vector<int64_t>> &&new_size) -> decltype(*this)¶
-
inline const std::optional<std::vector<int64_t>> &size() const noexcept¶
-
inline std::optional<std::vector<int64_t>> &size() noexcept¶
-
inline auto scale_factor(const std::optional<std::vector<double>> &new_scale_factor) -> decltype(*this)¶
multiplier for spatial size.
-
inline auto scale_factor(std::optional<std::vector<double>> &&new_scale_factor) -> decltype(*this)¶
-
inline const std::optional<std::vector<double>> &scale_factor() const noexcept¶
-
inline std::optional<std::vector<double>> &scale_factor() noexcept¶
-
inline auto mode(const mode_t &new_mode) -> decltype(*this)¶
the upsampling algorithm: one of “nearest”, “linear”, “bilinear”, “bicubic”, “trilinear”, “area”, “nearest-exact”.
Default: “nearest”
-
inline auto align_corners(const std::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
scale_factor
is kept the same. It is required when interpolating mode is “linear”, “bilinear”, “bicubic” or “trilinear”. Default: “False”
-
inline auto align_corners(std::optional<bool> &&new_align_corners) -> decltype(*this)¶
-
inline const std::optional<bool> &align_corners() const noexcept¶
-
inline std::optional<bool> &align_corners() noexcept¶
-
inline auto recompute_scale_factor(const std::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 theoutput_size
. Ifrecompute_scale_factor
istrue
or not specified, a newscale_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 computedoutput_size
were passed-in explicitly). Otherwise, the passed-inscale_factor
will be used in the interpolation computation. Note that whenscale_factor
is floating-point, the recomputed scale_factor may differ from the one passed in due to rounding and precision issues.
-
inline auto recompute_scale_factor(std::optional<bool> &&new_recompute_scale_factor) -> decltype(*this)¶
-
inline const std::optional<bool> &recompute_scale_factor() const noexcept¶
-
inline std::optional<bool> &recompute_scale_factor() noexcept¶
-
inline auto antialias(const bool &new_antialias) -> decltype(*this)¶
flag to apply anti-aliasing.
Using anti-alias option together with :attr:
align_corners
equals “False”, interpolation result would match Pillow result for downsampling operation. Supported modes: “bilinear”. Default: “False”.
-
inline auto antialias(bool &&new_antialias) -> decltype(*this)¶
-
inline const bool &antialias() const noexcept¶
-
inline bool &antialias() noexcept¶
-
typedef std::variant<enumtype::kNearest, enumtype::kLinear, enumtype::kBilinear, enumtype::kBicubic, enumtype::kTrilinear, enumtype::kArea, enumtype::kNearestExact> mode_t¶