Skip to content

Commit

Permalink
Merge branch 'update_evaluates' of github.com:mikhail-treskin/openvin…
Browse files Browse the repository at this point in the history
…o into update_evaluates

# Conflicts:
#	ngraph/test/runtime/interpreter/evaluates_map.cpp
  • Loading branch information
Mikhail Treskin committed Sep 15, 2020
2 parents 4039a80 + fdd3c16 commit 4eca370
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ngraph/test/backend/fused_op.in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ NGRAPH_TEST(${BACKEND_NAME}, depth_to_space_depth_first)
7.f, 23.f, 12.f, 28.f, 14.f, 30.f, 13.f, 29.f, 15.f, 31.f});
test_case.run();
}
// TODO: enable normalizeL2 tests after normalizeL2 reference implementation
// TODO: Issue: 37521
NGRAPH_TEST(${BACKEND_NAME}, DISABLED_normalize_across_chw_4d)
{
Shape data_shape{1, 2, 3, 4};
Expand Down
3 changes: 2 additions & 1 deletion ngraph/test/onnx/onnx_import.in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2528,7 +2528,8 @@ NGRAPH_TEST(${BACKEND_NAME}, onnx_prior_box)
test_case.run();
}

NGRAPH_TEST(${BACKEND_NAME}, onnx_normalize)
// TODO: Issue: 37521
NGRAPH_TEST(${BACKEND_NAME}, DISABLED_onnx_normalize)
{
const auto function = onnx_import::import_onnx_model(
file_util::path_join(SERIALIZED_ZOO, "onnx/normalize.prototxt"));
Expand Down
34 changes: 34 additions & 0 deletions ngraph/test/runtime/interpreter/evaluates_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include <ngraph/runtime/reference/reverse_sequence.hpp>
#include <ngraph/runtime/reference/rnn_cell.hpp>
#include <ngraph/runtime/reference/select.hpp>
#include <ngraph/runtime/reference/prior_box.hpp>
#include <interpreter/reference/mod.hpp>
#include "ngraph/ops.hpp"
#include "ngraph/runtime/reference/avg_pool.hpp"
#include "ngraph/runtime/reference/batch_norm.hpp"
Expand Down Expand Up @@ -434,6 +436,38 @@ namespace {
return true;
}

template <element::Type_t ET>
bool evaluate(const shared_ptr<op::v0::PriorBox>& op,
const HostTensorVector& outputs,
const HostTensorVector& input)
{
using T = typename element_type_traits<ET>::value_type;
std::cout << "djdkldld" << std::endl;
std:: cout << input[0]->get_data_ptr<T>()[0] << " " << input[0]->get_data_ptr<T>()[1] << std::endl;
auto cons = dynamic_pointer_cast<op::v0::Constant>(op->input_value(0).get_node_shared_ptr());
auto vec = cons->get_vector<int64_t>();
runtime::reference::prior_box<T>(input[0]->get_data_ptr<T>(),
input[1]->get_data_ptr<T>(),
outputs[0]->get_data_ptr<float>(),
outputs[0]->get_shape(),
op->get_attrs());
return true;
}

template <element::Type_t ET>
bool evaluate(const shared_ptr<op::v1::Mod>& op,
const HostTensorVector& outputs,
const HostTensorVector& input)
{
using T = typename element_type_traits<ET>::value_type;
runtime::reference::mod<T>(input[0]->get_data_ptr<T>(),
input[1]->get_data_ptr<T>(),
outputs[0]->get_data_ptr<T>(),
input[0]->get_shape(),
op->get_auto_broadcast());
return true;
}

template<element::Type_t ET>
bool evaluate(const shared_ptr<op::v0::Selu> &op,
const HostTensorVector &outputs,
Expand Down
2 changes: 2 additions & 0 deletions ngraph/test/runtime/interpreter/opset_int_tbl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ NGRAPH_OP(Gelu, op::v0)
NGRAPH_OP(HardSigmoid, op::v0)
NGRAPH_OP(LRN, ngraph::op::v0)
NGRAPH_OP(MVN, ngraph::op::v0)
NGRAPH_OP(PriorBox, ngraph::op::v0)
NGRAPH_OP(ReverseSequence, op::v0)
NGRAPH_OP(RNNCell, op::v0)
NGRAPH_OP(Selu, op::v0)
Expand All @@ -44,6 +45,7 @@ NGRAPH_OP(LogicalOr, op::v1)
NGRAPH_OP(LogicalXor, op::v1)
NGRAPH_OP(LogicalNot, op::v1)
NGRAPH_OP(MaxPool, op::v1)
NGRAPH_OP(Mod, op::v1)
NGRAPH_OP(OneHot, op::v1)
NGRAPH_OP(Pad, op::v1)
NGRAPH_OP(Select, op::v1)
Expand Down
42 changes: 42 additions & 0 deletions ngraph/test/runtime/interpreter/reference/mod.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//*****************************************************************************
// Copyright 2020 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************

#pragma once

#include <cmath>
#include <cstddef>

namespace ngraph
{
namespace runtime
{
namespace reference
{
template <typename T>
void mod(const T* arg0,
const T* arg1,
T* out,
const Shape& arg_shape,
const op::AutoBroadcastSpec& broadcast_spec)
{
autobroadcast_binop(
arg0, arg1, out, arg_shape, arg_shape, broadcast_spec, [](T x, T y) -> T {
return T(x - std::trunc(x / y) * y);
});
}
}
}
}

0 comments on commit 4eca370

Please sign in to comment.