[CPU] Dynamically shaped model with string tensor output fails (#21713)

This commit is contained in:
Nikolay Shchegolev authored and GitHub committed 2023-12-18 14:44:36 +04:00
1 parent be476519fb
commit 554e7d6730
3 files changed
+35 -34

No files matched your search

+9 -2
View File
@@ -78,7 +78,7 @@ Memory::Memory(const dnnl::engine& eng, const MemoryDesc& desc, MemoryMngrPtr mn
size_t Memory::getSize() const {
auto size = getDesc().getCurrentMemSize();
if (size == MemoryDesc::UNDEFINED_SIZE) {
if (size == MemoryDesc::UNDEFINED_SIZE) {
OPENVINO_THROW("Can't get memory size for undefined shape");
}
return size;
@@ -285,7 +285,6 @@ StringMemory::StringMemory(const dnnl::engine& engine, const MemoryDescPtr& desc
return;
}
m_size = m_mem_desc->getCurrentMemSize();
const auto string_size = m_mem_desc->getShape().getElementsCount();
if (data != nullptr) {
@@ -344,6 +343,14 @@ bool StringMemory::isAllocated() const noexcept {
return false;
}
size_t StringMemory::getSize() const { // In bytes
auto size = getDesc().getCurrentMemSize();
if (size == MemoryDesc::UNDEFINED_SIZE) {
OPENVINO_THROW("Can't get memory size for undefined shape.");
}
return size;
}
MemoryMngrPtr StringMemory::getMemoryMngr() const {
OPENVINO_THROW("Unexpected call of StringMemory::getMemoryMngr()");
}
+1 -4
View File
@@ -401,9 +401,7 @@ public:
void* getData() const override;
size_t getSize() const override { // In bytes
return m_size;
}
size_t getSize() const override; // In bytes
const Shape& getShape() const override {
return m_mem_desc->getShape();
@@ -431,7 +429,6 @@ private:
dnnl::engine m_engine;
MemoryDescPtr m_mem_desc;
StringMemoryMngrPtr m_manager;
size_t m_size;
};
using MemoryPtr = std::shared_ptr<IMemory>;
@@ -2,25 +2,25 @@
// SPDX-License-Identifier: Apache-2.0
//
// ----------------- ----------------
// | Parameter | | Constant |
// ----------------- ----------------
// | string | | string |
// ----------- ----------------------- -----------
// | Extension | | Extension | | Extension |
// ----------- ----------------------- -----------
// | u8 | string | string | u8
// -------- ----------- -------- --------
// | Result | | Extension | | Result | | Result |
// -------- ----------- -------- --------
// | u8
// ---------------
// | Bitwise (CPU) |
// ---------------
// | u8
// --------
// | Result |
// --------
// ------------------------------- -------------------
// | Parameter | | Constant |
// ------------------------------- -------------------
// | string | string | string | string | string
// -------- ----------- ----------------------- -----------
// | Result | | Extension | | Extension | | Extension |
// -------- ----------- ----------------------- -----------
// | u8 | string | string | u8
// -------- ----------- -------- --------
// | Result | | Extension | | Result | | Result |
// -------- ----------- -------- --------
// | u8
// ---------------
// | Bitwise (CPU) |
// ---------------
// | u8
// --------
// | Result |
// --------
#include "common_test_utils/ov_tensor_utils.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
@@ -176,21 +176,18 @@ protected:
auto in_0 = std::make_shared<ov::op::v0::Parameter>(in_type, inputDynamicShapes[0]);
auto in_1 = std::make_shared<ov::op::v0::Constant>(utils::create_and_fill_tensor(in_type, { 1, 3, 5 }));
ov::OutputVector param_outs_0({ in_0, in_1 });
auto str_str_op = std::make_shared<CustomOpStringString>(param_outs_0);
ov::OutputVector param_outs_1({ str_str_op->output(0) });
auto str_u8_op_0 = std::make_shared<CustomOpStringU8>(param_outs_1);
ov::OutputVector param_outs_2({ in_0 });
auto str_u8_op_1 = std::make_shared<CustomOpStringU8>(param_outs_2);
ov::OutputVector param_outs_3({ in_1 });
auto str_u8_op_2 = std::make_shared<CustomOpStringU8>(param_outs_3);
auto str_str_op = std::make_shared<CustomOpStringString>(ov::OutputVector{in_0, in_1});
auto str_u8_op_0 = std::make_shared<CustomOpStringU8>(ov::OutputVector{str_str_op});
auto str_u8_op_1 = std::make_shared<CustomOpStringU8>(ov::OutputVector{in_0});
auto str_u8_op_2 = std::make_shared<CustomOpStringU8>(ov::OutputVector{in_1});
auto btw_not_op = std::make_shared<ov::op::v13::BitwiseNot>(str_u8_op_0->output(0));
ov::ParameterVector input_params{in_0};
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(btw_not_op->output(0)),
std::make_shared<ov::op::v0::Result>(str_str_op->output(1)),
std::make_shared<ov::op::v0::Result>(str_u8_op_1->output(0)),
std::make_shared<ov::op::v0::Result>(str_u8_op_2->output(0))};
std::make_shared<ov::op::v0::Result>(str_u8_op_2->output(0)),
std::make_shared<ov::op::v0::Result>(in_0->output(0))};
function = std::make_shared<ov::Model>(results, input_params, "CustomOpStringString");
}