Hi
The function exists below link , is still before release.
If you need the following function, either code it yourself or use the nightly build version.
//usage sample
torch ::nn::functional::detail ::pad(
input_data.unsqueeze(1), {2,2,0,0},torch::nn::functional::PadFuncOptions().mode(torch::kReplicate));
if (padding.size() > 4) {
input = torch::cat({input, _narrow_with_range(input, 4, 0, padding[-5 + padding.size()])}, /*dim=*/4);
input = torch::cat({_narrow_with_range(input, 4, -(padding[-5 + padding.size()] + padding[-6 + padding.size()]), -padding[-5 + padding.size()]), input}, /*dim=*/4);
}
return input;
}
namespace detail {
inline Tensor pad(const Tensor& input,
IntArrayRef pad,
PadFuncOptions::mode_t mode,
double value) {
TORCH_CHECK(pad.size() % 2 == 0, "Padding length must be divisible by 2");
TORCH_CHECK(((int64_t)(pad.size() / 2)) <= input.dim(), "Padding length too large");
if (c10::get_if<enumtype::kConstant>(&mode)) {
return torch::constant_pad_nd(input, pad, value);
} else {
TORCH_CHECK(
value == 0,
1 Like