Publishing 2019 R1.1 content and Myriad plugin sources (#162)
[platform/upstream/dldt.git] / inference-engine / tests / unit / engines / gna / matchers / conv_matcher.hpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include"gna-api.h"
8 #include "nnet_base_matcher.hpp"
9 #include "quantization/quantization.h"
10
11 class ConvoluionLayerMatcher : public ::testing::MatcherInterface<const intel_nnet_type_t*> {
12     bool matchInserted;
13     int matchQuantity;
14  public:
15     ConvoluionLayerMatcher(bool matchInserted, int matchQuantity) : matchInserted(matchInserted), matchQuantity(matchQuantity) {}
16     bool MatchAndExplain(const intel_nnet_type_t *foo, ::testing::MatchResultListener *listener) const override {
17         if (foo == nullptr)
18             return false;
19         for(int i = 0; i < foo->nLayers; i++) {
20             if (foo->pLayers[i].nLayerKind != INTEL_CONVOLUTIONAL) continue;
21
22             auto conv = (intel_convolutional_layer_t*)foo->pLayers[i].pLayerStruct;
23
24             return matchInserted;
25         }
26         return !matchInserted;
27     };
28     void DescribeTo(::std::ostream *os) const override {
29         *os << "should "<< (matchInserted ? "" : "not ") << "have Convolution primitive as part of nnet structure";
30     }
31 };
32
33
34