2 // Copyright 2016-2018 Intel Corporation.
4 // This software and the related documents are Intel copyrighted materials,
5 // and your use of them is governed by the express license under which they
6 // were provided to you (End User License Agreement for the Intel(R) Software
7 // Development Products (Version May 2017)). Unless the License provides
8 // otherwise, you may not use, modify, copy, publish, distribute, disclose or
9 // transmit this software or the related documents without Intel's prior
10 // written permission.
12 // This software and the related documents are provided as is, with no
13 // express or implied warranties, other than those that are expressly
14 // stated in the License.
17 #include <gtest/gtest.h>
18 #include <gmock/gmock-generated-actions.h>
19 #include "gna_matcher.hpp"
20 #include "matchers/input_data_matcher.hpp"
21 #include "test_irs.hpp"
24 using namespace InferenceEngine;
25 using namespace ::testing;
26 using namespace GNATestIRs;
28 class GNAInputPrecisionTest : public GNATest {
31 TEST_F(GNAInputPrecisionTest, CanProcessU8Input) {
32 std::vector<float> input_init = {128, 128, 128, 128, 128, 128, 128, 128, 128, 128};
33 double scale = 1.f / 128;
34 std::vector<int16_t> input_processed = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
36 assert_that().onInferModel(Fc2DOutputModel())
37 .inNotCompactMode().gna().propagate_forward().called_with()
38 .preprocessed_input_data(input_init, input_processed, Precision::U8)
39 .withGNAConfig(GNA_CONFIG_KEY(SCALE_FACTOR), scale);
42 TEST_F(GNAInputPrecisionTest, CanProcessFP32Input) {
43 std::vector<float> input_init = {1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280};
44 double scale = 1.f / 1280;
45 std::vector<int16_t> input_processed = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
47 assert_that().onInferModel(Fc2DOutputModel())
48 .inNotCompactMode().gna().propagate_forward().called_with()
49 .preprocessed_input_data(input_init, input_processed, Precision::FP32)
50 .withGNAConfig(GNA_CONFIG_KEY(SCALE_FACTOR), scale);