From ea84e732821a0fdf722d775e45a956440d934449 Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Tue, 18 Jul 2023 23:57:32 +0400 Subject: [PATCH] Revert "Revert "Fixed cases if cast data from Tensor to compatible type (#18479)" (#18539)" (#18599) This reverts commit 3daa387692e12b96d3d08805423a147525e4458d. --- src/core/tests/ov_tensor_test.cpp | 2 +- src/inference/src/dev/make_tensor.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/tests/ov_tensor_test.cpp b/src/core/tests/ov_tensor_test.cpp index 6a67c78136e..102b2ca2e09 100644 --- a/src/core/tests/ov_tensor_test.cpp +++ b/src/core/tests/ov_tensor_test.cpp @@ -71,7 +71,7 @@ TEST_F(OVTensorTest, canAccessF16Tensor) { EXPECT_NE(nullptr, t.data()); EXPECT_NO_THROW(t.data(ov::element::f16)); EXPECT_NO_THROW(t.data()); - EXPECT_THROW(t.data(), ov::Exception); + EXPECT_NO_THROW(t.data()); EXPECT_THROW(t.data(), ov::Exception); EXPECT_THROW(t.data(), ov::Exception); } diff --git a/src/inference/src/dev/make_tensor.cpp b/src/inference/src/dev/make_tensor.cpp index 137f1412e08..c72d7a2c3c1 100644 --- a/src/inference/src/dev/make_tensor.cpp +++ b/src/inference/src/dev/make_tensor.cpp @@ -36,7 +36,8 @@ public: void* data(const element::Type& element_type) const override { if (element_type != element::undefined && element_type != element::dynamic) { - OPENVINO_ASSERT(element_type == get_element_type(), + OPENVINO_ASSERT(element_type.bitwidth() == get_element_type().bitwidth() && + element_type.is_real() == get_element_type().is_real(), "Tensor data with element type ", get_element_type(), ", is not representable as pointer to ",