Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / tests / unit / builders / tanh_layer_test.cpp
1 // Copyright (C) 2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #include <gtest/gtest.h>
6 #include <string.h>
7 #include <ie_builders.hpp>
8 #include <builders/ie_tanh_layer.hpp>
9
10 #include "builder_test.hpp"
11
12 using namespace testing;
13 using namespace InferenceEngine;
14
15 class TanHLayerBuilderTest : public BuilderTestCommon {};
16
17 TEST_F(TanHLayerBuilderTest, getExistsLayerFromNetworkBuilder) {
18     Builder::Network net("network");
19     Builder::TanHLayer tanhLayer("TanH_layer");
20     size_t ind = net.addLayer(tanhLayer);
21     Builder::TanHLayer layerFromNet(net.getLayer(ind));
22 }
23
24 TEST_F(TanHLayerBuilderTest, cannotCreateLayerWithWrongShapes) {
25     Builder::Network net("network");
26     Builder::Layer::Ptr fakeTanHLayerPtr = std::make_shared<Builder::Layer>("TanH", "TanH layer");
27     fakeTanHLayerPtr->getInputPorts().push_back(Port({1, 1, 1, 1}));
28     fakeTanHLayerPtr->getOutputPorts().push_back(Port({1, 1, 1, 2}));
29     Builder::TanHLayer tanhLayer(fakeTanHLayerPtr);
30     ASSERT_THROW(net.addLayer(tanhLayer), InferenceEngine::details::InferenceEngineException);
31 }