Generate shape-independent graph if any input dimension < 2 (#6581)

* Throw for non-supported case

* Not to go to shape-dependent branch when seeing unsupported shapes
This commit is contained in:
Wei-Sheng Chin 2021-02-10 15:44:25 +08:00 committed by GitHub
parent 8f0b877a1d
commit 8972621138
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -194,7 +194,8 @@ IMPLEMENT_GRADIENT_BUILDER(GetMatMulGradient) {
}
};
if (A_has_shape && B_has_shape && Y_has_shape) {
if (A_has_shape && B_has_shape && Y_has_shape &&
A_shape.size() >= 2 && B_shape.size() >= 2) {
std::vector<AttributeProto> shared_attributes;
shared_attributes.push_back(MakeAttribute("beta", float(0)));
AttributeProto transpose_first_input = MakeAttribute("transA", int64_t(1));