openvino/ngraph/test/visitors/op/elu.cpp

34 lines
858 B
C++

// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "gtest/gtest.h"
#include "ngraph/ngraph.hpp"
#include "ngraph/op/util/attr_types.hpp"
#include "ngraph/opsets/opset1.hpp"
#include "ngraph/opsets/opset3.hpp"
#include "ngraph/opsets/opset4.hpp"
#include "ngraph/opsets/opset5.hpp"
#include "util/visitor.hpp"
using namespace std;
using namespace ngraph;
using ngraph::test::NodeBuilder;
using ngraph::test::ValueMap;
TEST(attributes, elu_op)
{
NodeBuilder::get_ops().register_factory<opset1::Elu>();
auto data = make_shared<op::Parameter>(element::f32, Shape{2, 4});
double alpha = 0.1;
const auto elu = make_shared<opset1::Elu>(data, alpha);
NodeBuilder builder(elu);
auto g_elu = as_type_ptr<opset1::Elu>(builder.create());
EXPECT_EQ(g_elu->get_alpha(), elu->get_alpha());
}