Fix tensor vector comparator for set (#15433)

This commit is contained in:
Pawel Raasz 2023-02-03 10:23:01 +01:00 committed by GitHub
parent ab509ce164
commit 1de937b66b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,7 +176,13 @@ ov::Tensor or_tensor(const ov::Tensor& lhs, const ov::Tensor& rhs) {
struct TensorVectorCmp {
bool operator()(const ov::TensorVector& lhs, const ov::TensorVector& rhs) const {
return !std::equal(lhs.begin(), lhs.end(), rhs.begin(), &are_same_tensor);
auto rhs_it = rhs.begin();
return std::any_of(lhs.begin(), lhs.end(), [&rhs_it](const ov::Tensor& lhs) {
bool is_less =
(lhs && *rhs_it) ? lhs.data() < rhs_it->data() : static_cast<bool>(lhs) < static_cast<bool>(*rhs_it);
++rhs_it;
return is_less;
});
}
};