summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Zhang <jerryzh@fb.com>2019-04-11 19:38:21 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2019-04-11 19:43:18 -0700
commit7e73783c6fefb592a112859781cf662bfb0f408d (patch)
treec150ce9eed1447c85a8bfc4c88885b074998e46a
parent422b01e78889a9fd283d8fb86bb5527c5cae3cbf (diff)
downloadpytorch-7e73783c6fefb592a112859781cf662bfb0f408d.tar.gz
pytorch-7e73783c6fefb592a112859781cf662bfb0f408d.tar.bz2
pytorch-7e73783c6fefb592a112859781cf662bfb0f408d.zip
Fix promoteTypes for QInt types (#19182)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/19182 This is a bug discovered by zafartahirov, right now if one of the tensor is QInt type we'll return undefined, but actually we want to allow ops that accepts Tensors of the same QInt type to work. Reviewed By: zafartahirov Differential Revision: D14909172 fbshipit-source-id: 492fd6403da8c56e180efe9d632a3b7fc879aecf
-rw-r--r--c10/core/ScalarType.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/c10/core/ScalarType.h b/c10/core/ScalarType.h
index 99e7975d35..b34ed427d3 100644
--- a/c10/core/ScalarType.h
+++ b/c10/core/ScalarType.h
@@ -246,6 +246,11 @@ static inline ScalarType promoteTypes(ScalarType a, ScalarType b) {
"promoteTypes with complex numbers is not handled yet; figure out what the correct rules should be");
}
+ // For QInt types, we only allow exact match
+ if (isQIntType(a) && a == b) {
+ return a;
+ }
+
if (isQIntType(a) || isQIntType(b)) {
AT_ERROR(
"promoteTypes with quantized numbers is not handled yet; figure out what the correct rules should be");