Revert "Revert "Fixed cases if cast data from Tensor to compatible type (#18479)" (#18539)" (#18599)
This reverts commit 3daa387692
.
This commit is contained in:
parent
f0abd468a2
commit
ea84e73282
@ -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<ov::float16>());
|
||||
EXPECT_THROW(t.data<ov::bfloat16>(), ov::Exception);
|
||||
EXPECT_NO_THROW(t.data<ov::bfloat16>());
|
||||
EXPECT_THROW(t.data<std::uint16_t>(), ov::Exception);
|
||||
EXPECT_THROW(t.data<std::int16_t>(), ov::Exception);
|
||||
}
|
||||
|
@ -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 ",
|
||||
|
Loading…
Reference in New Issue
Block a user