Files
openvino/ngraph/test/int4.cpp
Patryk Elszkowski 576e750317 Constant op class update for Low Precision (#5311)
* add support for u1, u4 and i4 in op::v1::Constant

* fix convert_i4_to_string test

* Fix makeBinaryConvolution to fill memory allocated for LP types

* Add unit-test for range validation

Co-authored-by: Patryk Elszkowski <patryk.elszkowki@intel.com>
2021-04-23 07:31:04 +03:00

24 lines
562 B
C++

// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "gtest/gtest.h"
#include "ngraph/ngraph.hpp"
#include "util/all_close_f.hpp"
#include "util/test_tools.hpp"
using namespace ngraph;
using namespace std;
TEST(int4, convert_i4_to_string)
{
vector<uint8_t> values{171, 16};
auto constant = make_shared<op::Constant>(element::i4, Shape{3}, &values[0]);
vector<string> ref{"-6", "-5", "1"};
for (size_t i = 0; i < 3; ++i)
{
ASSERT_EQ(constant->convert_value_to_string(i), ref[i]);
}
}