-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[quant] conv_transpose1d / conv_transpose2d #40370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 22e676a (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
[ghstack-poisoned]
[ghstack-poisoned]
|
UPDATE: Resolved! There is a weird bug, that I was tracking the whole weekend -- would appreciate if someone could tell me what's wrong. Here is repro code import numpy as np
import torch
from torch import nn
torch.backends.quantized.engine = 'qnnpack'
B = 2
L = 24
iC = 1
oC = 2
kL = 1
strides = (1,)
pads = (0,)
o_pads = (0,)
dilations = (1,)
groups = 1
X = torch.randn(B, iC, L).to(torch.float)
W = torch.randn(iC, oC // groups, kL)
X_s = 1.2
X_zp = 0
X_dtype = torch.quint8
W_s = 0.2
W_zp = 0
W_dtype = torch.qint8
b = None
y_s = 4.2
y_zp = 0
#################
X_q = torch.quantize_per_tensor(X, X_s, X_zp, X_dtype)
W_q = torch.quantize_per_tensor(W, W_s, W_zp, W_dtype)
#################
kernel_size = kL,
conv_ref = nn.ConvTranspose1d(iC, oC, kernel_size, stride=strides, padding=pads,
output_padding=o_pads, groups=groups,
bias=(b is not None), dilation=dilations)
conv_ref.weight = nn.Parameter(W)
if b is not None:
conv_ref.bias = nn.Parameter(b)
y_ref = conv_ref(X)
y_ref_dq = torch.quantize_per_tensor(y_ref, y_s, y_zp, X_dtype).int_repr()
#################
W_prepack = torch.ops.quantized.conv_transpose1d_prepack(W_q, b, strides, pads,
o_pads, dilations,
groups)
W_unpacked, bias = torch.ops.quantized.conv_transpose1d_unpack(W_prepack)
print(W_q.dequantize() - W_unpacked.dequantize())
#################
y_q = torch.ops.quantized.conv_transpose1d(X_q, W_prepack, y_s, y_zp).int_repr()
#################
print(y_ref_dq.to(torch.float) - y_q.to(torch.float))
print(
f'''
iC: {W.shape[0]}
oC: {W.shape[1] * groups}
k: {W.shape[2:]}
'''
)result for the difference is expected to have maximum 1-off (actually >1-off due to deconv), but it looks like the only the first Output: tensor([[[0.],
[0.]]])
tensor([[[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0.],
[ 0., -36., 0., 0., 0., -36., -36., 0., -36., 0., 0.,
0., 0., 0., -36., 0., -73., -73., 0., 0., -36., -36.,
0., 0.]],
[[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0.],
[ 0., -36., 0., 0., 0., -36., 0., 0., 0., 0., 0.,
0., 0., -36., 0., 0., -36., 0., -36., 0., 0., 0.,
-36., 0.]]])
iC: 1
oC: 2
k: torch.Size([1]) |
|
@z-a-f, I can't say without knowing the details of the op. I am assuming this does not fail with fbgemm backend. |
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
vkuzo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to add a numerical correctness test in this PR?
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
vkuzo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. Should we add a numerical correctness test in this PR?
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Yes -- I had the tests, they accidentally were submitted as part of a different PR -- I will migrate them here |
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
vkuzo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lg as long as CI passes. Can we include the context and the test plan in the PR summary before landing, since this is non-trivial?
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Differential Revision: [D22158979](https://our.internmc.facebook.com/intern/diff/D22158979) [ghstack-poisoned]
Summary: Pull Request resolved: #40370 Test Plan: Imported from OSS Reviewed By: vkuzo Differential Revision: D22158979 Pulled By: z-a-f fbshipit-source-id: f5cb812c9953efa7608f06cf0188de447f73f358
Stack from ghstack:
Differential Revision: D22158979