forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MKLDNNMemoryDesc undefined state has been implemented
- Loading branch information
Showing
14 changed files
with
852 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "cpu_shape.h" | ||
#include "utils/general_utils.h" | ||
|
||
using namespace MKLDNNPlugin; | ||
|
||
bool Shape::isCompatible(const std::vector<size_t> &vecDims) const { | ||
if (getRank() != vecDims.size()) { | ||
return false; | ||
} | ||
|
||
auto comparator = [](size_t lhs, size_t rhs) { | ||
return (lhs == rhs) || (lhs == Shape::UNDEFINED_DIM); | ||
}; | ||
|
||
if (!std::equal(getDims().begin(), getDims().end(), vecDims.begin(), comparator)) { | ||
return false; | ||
} | ||
|
||
if (!std::equal(getMaxDims().begin(), getMaxDims().end(), vecDims.begin(), [](size_t lhs, size_t rhs) { return lhs >= rhs; })) { | ||
return false; | ||
} | ||
|
||
if (!std::equal(getMinDims().begin(), getMinDims().end(), vecDims.begin(), [](size_t lhs, size_t rhs) { return lhs <= rhs; })) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
std::string Shape::toString() const { | ||
std::stringstream output; | ||
output << "{"; | ||
|
||
size_t i = 0; | ||
do { | ||
if (dims[i] == Shape::UNDEFINED_DIM) { | ||
output << dim2str(minDims[i]) << " - " << dim2str(maxDims[i]); | ||
} else { | ||
output << dims[i]; | ||
} | ||
} while (++i < dims.size() && output << ", "); | ||
|
||
output << "}"; | ||
return output.str(); | ||
} |
Oops, something went wrong.