[GPU] fix constant shape if its user has scalar inputs (#8564)

* [GPU] fix constant shape if its user has scalar inputs

Currently for nodes like:
```
Multiply(input{}, mul_const{2}) -> mul{2}
```
cldnn sets 'mul_const' shape to (1, 2, 1, 1), which may not be correct if it's followed by
```
Add(mul{2}, add_const{2}) -> add{2}
```
because 'mul' shape is (1, 2, 1, 1), 'add_const' shape is (2, 1, 1, 1)
and the result becomes (2, 2, 1, 1) instead of expected (2, 1, 1, 1)

* Add tests for the issue
This commit is contained in:
Mateusz Tabaka 2021-11-15 20:08:02 +01:00 committed by GitHub
parent 2e9f83d705
commit c5d0dc3e5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -103,7 +103,7 @@ static void CreateConstantOp(Program& p, const std::shared_ptr<ngraph::op::v0::C
bool all_inputs_1d = true;
for (size_t j = 0; j < outOp->get_input_size(); j++) {
auto& in_shape = outOp->get_input_shape(j);
if (in_shape.size() != 1)
if (in_shape.size() > 1)
all_inputs_1d = false;
}
needsBatchInterpretation = all_inputs_1d;

View File

@ -11,6 +11,7 @@ using namespace ov::test::subgraph;
namespace {
std::vector<std::vector<ov::Shape>> inShapes = {
{{2}},
{{}, {34100}},
{{2, 200}},
{{10, 200}},
{{1, 10, 100}},

View File

@ -88,7 +88,7 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*CanSetOutBlobWithDifferentPrecision/netPRC=(I4|U4).*)",
R"(.*CanSetOutBlobWithDifferentPrecision/netPRC=BIN.*)",
// TODO: Issue: 67486
R"(.*(EltwiseLayerTest|SoftMaxLayerTest).*)",
R"(.*(SoftMaxLayerTest).*)",
// TODO: Issue: 68712
R"(.*.MatMul.*CompareWithRefs.*IS0=\(1.5\)_IS1=\(1.5\).*transpose_a=0.*transpose_b=1.*CONSTANT.*FP16.*UNSPECIFIED.*UNSPECIFIED.*ANY.*)",
// TODO: Issue 66685