Lines Matching full:pad
29 Tensor constant_pad_nd(const Tensor& self, IntArrayRef pad, const Scalar& value) { in constant_pad_nd() argument
30 TORCH_CHECK(pad.size() % 2 == 0, "Length of pad must be even but instead it equals ", in constant_pad_nd()
31 pad.size()); in constant_pad_nd()
36 auto l_pad = pad.size() / 2; in constant_pad_nd()
38 TORCH_CHECK(l_inp >= (int64_t)l_pad, "Length of pad should be no more than twice the number of " in constant_pad_nd()
39 "dimensions of the input. Pad length is ", pad.size(), "while the input has ", in constant_pad_nd()
49 if (pad[pad_idx] < 0) { in constant_pad_nd()
50 c_input = c_input.narrow(i, -pad[pad_idx], c_input.size(i) + pad[pad_idx]); in constant_pad_nd()
51 } else if (pad[pad_idx] != 0) { in constant_pad_nd()
54 if (pad[pad_idx + 1] < 0) { in constant_pad_nd()
55 c_input = c_input.narrow(i, 0, c_input.size(i) + pad[pad_idx + 1]); in constant_pad_nd()
56 } else if (pad[pad_idx + 1] != 0) { in constant_pad_nd()
73 auto pad_idx = pad.size() - ((i + 1) * 2); in constant_pad_nd()
74 auto new_dim = input_sizes[l_diff + i] + pad[pad_idx] + pad[pad_idx + 1]; in constant_pad_nd()
76 pad[pad_idx], " and ", pad[pad_idx + 1], " resulted in a negative output size, " in constant_pad_nd()
98 if (pad[pad_idx] > 0) { in constant_pad_nd()
99 c_output = c_output.narrow(i, pad[pad_idx], c_output.size(i) - pad[pad_idx]); in constant_pad_nd()
101 if (pad[pad_idx + 1] > 0) { in constant_pad_nd()
102 c_output = c_output.narrow(i, 0, c_output.size(i) - pad[pad_idx + 1]); in constant_pad_nd()
162 // The following steps first pad the beginning of the tensor (left side), in _pad_circular_symint()
163 // and then pad the end of the tensor (right side). in _pad_circular_symint()
191 Tensor _pad_enum_symint(const Tensor &self, c10::SymIntArrayRef pad, int64_t mode_int, std::optiona… in _pad_enum_symint() argument
193 TORCH_CHECK(pad.size() % 2 == 0, "Padding length must be divisible by 2"); in _pad_enum_symint()
194 TORCH_CHECK(static_cast<int64_t>(pad.size()) <= input_dim * 2, in _pad_enum_symint()
195 …s than or equal to two times the input dimension but got padding length ", pad.size(), " and input… in _pad_enum_symint()
199 return at::constant_pad_nd_symint(self, pad, value.value_or(0.0)); in _pad_enum_symint()
205 if (pad.size() == 2 && (input_dim == 2 || input_dim == 3)) { in _pad_enum_symint()
207 case at::padding_mode::reflect: return at::reflection_pad1d_symint(self, pad); in _pad_enum_symint()
208 case at::padding_mode::replicate: return at::replication_pad1d_symint(self, pad); in _pad_enum_symint()
209 case at::padding_mode::circular: return at::_pad_circular_symint(self, pad); in _pad_enum_symint()
212 } else if(pad.size() == 4 && (input_dim == 3 || input_dim == 4)) { in _pad_enum_symint()
214 case at::padding_mode::reflect: return at::reflection_pad2d_symint(self, pad); in _pad_enum_symint()
215 case at::padding_mode::replicate: return at::replication_pad2d_symint(self, pad); in _pad_enum_symint()
216 case at::padding_mode::circular: return at::_pad_circular_symint(self, pad); in _pad_enum_symint()
219 } else if (pad.size() == 6 && (input_dim == 4 || input_dim == 5)) { in _pad_enum_symint()
221 case at::padding_mode::reflect: return at::reflection_pad3d_symint(self, pad); in _pad_enum_symint()
222 case at::padding_mode::replicate: return at::replication_pad3d_symint(self, pad); in _pad_enum_symint()
223 case at::padding_mode::circular: return at::_pad_circular_symint(self, pad); in _pad_enum_symint()
231 Tensor pad_symint(const Tensor &self, c10::SymIntArrayRef pad, c10::string_view mode, std::optional… in pad_symint() argument
245 return at::native::_pad_enum_symint(self, pad, static_cast<int64_t>(mode_enum), value); in pad_symint()