SymIntify convolution backend calculation (#89069)

We will need this to implement a convolution meta function that
is SymInt aware.  I use templates so that regular convolution code
is not affected by the change.  No tests for symbolic ints directly; that will
come in a subsequent PR which also needs to refactor fake tensors.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/89069
Approved by: https://github.com/SherlockNoMad
This commit is contained in:
Edward Z. Yang
2022-11-15 10:10:28 -08:00
committed by PyTorch MergeBot
parent 5e0c01330c
commit 09ed8b67e2
5 changed files with 261 additions and 179 deletions

View File

@ -1408,10 +1408,10 @@ Call this whenever a new thread is created in order to propagate values from
const at::Tensor& weight,
const c10::optional<at::Tensor>& bias_opt,
at::IntArrayRef stride_,
at::IntArrayRef padding_,
at::SymIntArrayRef padding_,
at::IntArrayRef dilation_,
bool transposed_,
at::IntArrayRef output_padding_,
at::SymIntArrayRef output_padding_,
int64_t groups_) {
return at::native::select_conv_backend(
input,
@ -1442,13 +1442,13 @@ Call this whenever a new thread is created in order to propagate values from
const at::Tensor& weight,
const c10::optional<at::Tensor>& bias,
at::IntArrayRef stride_,
at::IntArrayRef padding_,
at::SymIntArrayRef padding_,
at::IntArrayRef dilation_,
bool transposed_,
at::IntArrayRef output_padding_,
at::SymIntArrayRef output_padding_,
int64_t groups_,
c10::optional<std::vector<int64_t>> bias_sizes_opt) {
c10::OptionalArrayRef<int64_t> ref = c10::nullopt;
c10::optional<std::vector<c10::SymInt>> bias_sizes_opt) {
c10::OptionalArrayRef<c10::SymInt> ref = c10::nullopt;
if (bias_sizes_opt) {
ref = (*bias_sizes_opt);
}