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.
19 #include <gtest/gtest.h>
20 #include <mock_icnn_network.hpp>
21 #include <cpp/ie_cnn_net_reader.h>
22 #include <gmock/gmock-generated-actions.h>
23 #include "gna_matcher.hpp"
26 using namespace InferenceEngine;
27 using namespace ::testing;
29 class GNAHWPrecisionTest : public GNATest {
33 TEST_F(GNAHWPrecisionTest, defaultPrecisionIsInt16) {
34 assert_that().onInfer1AFModel().gna().propagate_forward().called_with().
35 nnet_input_precision(Precision::I16).
36 nnet_ouput_precision(Precision::I32).
37 nnet_weights_precision(Precision::I16).
38 nnet_biases_precision(Precision::I32);
41 TEST_F(GNAHWPrecisionTest, canPassInt8Precision) {
42 assert_that().onInfer1AFModel().withConfig(PRECISION, Precision::I8).
43 gna().propagate_forward().called_with().
44 nnet_input_precision(Precision::I16).
45 nnet_ouput_precision(Precision::I32).
46 nnet_weights_precision(Precision::I8).
47 nnet_biases_precision(Precision::fromType<intel_compound_bias_t>());
50 TEST_F(GNAHWPrecisionTest, canPassInt16Precision) {
51 assert_that().onInfer1AFModel().withConfig(PRECISION, Precision::I16).
52 gna().propagate_forward().called_with().
53 nnet_input_precision(Precision::I16).
54 nnet_ouput_precision(Precision::I32).
55 nnet_weights_precision(Precision::I16).
56 nnet_biases_precision(Precision::I32);
59 TEST_F(GNAHWPrecisionTest, failToCreatePluginWithUnsuportedPrecision) {
60 assert_that().creating().gna_plugin().withConfig(PRECISION, Precision::FP32).throws();