Remove obsoleted Min, Max operators (#2832)
This commit is contained in:
parent
901f1e0436
commit
1144eefe4d
@ -23,46 +23,6 @@ namespace ngraph
|
|||||||
{
|
{
|
||||||
namespace op
|
namespace op
|
||||||
{
|
{
|
||||||
namespace v0
|
|
||||||
{
|
|
||||||
/// \brief Max-reduction operation.
|
|
||||||
class NGRAPH_DEPRECATED(
|
|
||||||
"This operation is deprecated and will be removed soon. "
|
|
||||||
"Use v1::ReduceMax instead of it.") NGRAPH_API Max
|
|
||||||
: public util::ArithmeticReduction
|
|
||||||
{
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
|
||||||
public:
|
|
||||||
static constexpr NodeTypeInfo type_info{"Max", 0};
|
|
||||||
|
|
||||||
const NodeTypeInfo& get_type_info() const override { return type_info; }
|
|
||||||
/// \brief Constructs a "max" reduction operation.
|
|
||||||
Max() = default;
|
|
||||||
|
|
||||||
/// \brief Constructs a max-reduction operation.
|
|
||||||
///
|
|
||||||
/// \param arg The tensor to be reduced.
|
|
||||||
/// \param reduction_axes The axis positions (0-based) to be elimaxated.
|
|
||||||
Max(const Output<Node>& arg, const AxisSet& reduction_axes);
|
|
||||||
|
|
||||||
/// \brief Constructs a "max" reduction operation.
|
|
||||||
///
|
|
||||||
/// \param arg The tensor to be reduced.
|
|
||||||
/// \param reduction_axes The axis positions (0-based) to be elimaxated.
|
|
||||||
Max(const Output<Node>& arg, const Output<Node>& reduction_axes);
|
|
||||||
|
|
||||||
virtual std::shared_ptr<Node>
|
|
||||||
clone_with_new_inputs(const OutputVector& new_args) const override;
|
|
||||||
|
|
||||||
/// \return The default value for Max.
|
|
||||||
virtual std::shared_ptr<Node> get_default_value() const override;
|
|
||||||
|
|
||||||
bool evaluate(const HostTensorVector& outputs,
|
|
||||||
const HostTensorVector& inputs) const override;
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace v1
|
namespace v1
|
||||||
{
|
{
|
||||||
class NGRAPH_API ReduceMax : public util::ArithmeticReductionKeepDims
|
class NGRAPH_API ReduceMax : public util::ArithmeticReductionKeepDims
|
||||||
@ -88,9 +48,5 @@ namespace ngraph
|
|||||||
const HostTensorVector& inputs) const override;
|
const HostTensorVector& inputs) const override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
|
||||||
using v0::Max;
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,46 +23,6 @@ namespace ngraph
|
|||||||
{
|
{
|
||||||
namespace op
|
namespace op
|
||||||
{
|
{
|
||||||
namespace v0
|
|
||||||
{
|
|
||||||
/// \brief Min-reduction operation.
|
|
||||||
class NGRAPH_DEPRECATED(
|
|
||||||
"This operation is deprecated and will be removed soon. "
|
|
||||||
"Use v1::ReduceMin instead of it.") NGRAPH_API Min
|
|
||||||
: public util::ArithmeticReduction
|
|
||||||
{
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
|
||||||
public:
|
|
||||||
static constexpr NodeTypeInfo type_info{"Min", 0};
|
|
||||||
|
|
||||||
const NodeTypeInfo& get_type_info() const override { return type_info; }
|
|
||||||
/// \brief Constructs a "min" reduction operation.
|
|
||||||
Min() = default;
|
|
||||||
|
|
||||||
/// \brief Constructs a min-reduction operation.
|
|
||||||
///
|
|
||||||
/// \param arg The tensor to be reduced.
|
|
||||||
/// \param reduction_axes The axis positions (0-based) to be eliminated.
|
|
||||||
Min(const Output<Node>& arg, const AxisSet& reduction_axes);
|
|
||||||
|
|
||||||
/// \brief Constructs a "min" reduction operation.
|
|
||||||
///
|
|
||||||
/// \param arg The tensor to be reduced.
|
|
||||||
/// \param reduction_axes The axis positions (0-based) to be eliminated.
|
|
||||||
Min(const Output<Node>& arg, const Output<Node>& reduction_axes);
|
|
||||||
|
|
||||||
virtual std::shared_ptr<Node>
|
|
||||||
clone_with_new_inputs(const OutputVector& new_args) const override;
|
|
||||||
|
|
||||||
/// \return The default value for Min.
|
|
||||||
virtual std::shared_ptr<Node> get_default_value() const override;
|
|
||||||
|
|
||||||
bool evaluate(const HostTensorVector& outputs,
|
|
||||||
const HostTensorVector& inputs) const override;
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace v1
|
namespace v1
|
||||||
{
|
{
|
||||||
class NGRAPH_API ReduceMin : public util::ArithmeticReductionKeepDims
|
class NGRAPH_API ReduceMin : public util::ArithmeticReductionKeepDims
|
||||||
@ -88,9 +48,5 @@ namespace ngraph
|
|||||||
const HostTensorVector& inputs) const override;
|
const HostTensorVector& inputs) const override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
|
||||||
using v0::Min;
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,9 @@ NGRAPH_OP(LogicalOr, ngraph::op::v1, 1)
|
|||||||
NGRAPH_OP(LogicalXor, ngraph::op::v1, 1)
|
NGRAPH_OP(LogicalXor, ngraph::op::v1, 1)
|
||||||
NGRAPH_OP(MVN, ngraph::op::v0, 0)
|
NGRAPH_OP(MVN, ngraph::op::v0, 0)
|
||||||
NGRAPH_OP(MatMul, ngraph::op::v0, 0)
|
NGRAPH_OP(MatMul, ngraph::op::v0, 0)
|
||||||
NGRAPH_OP(Max, ngraph::op::v0, 0)
|
|
||||||
NGRAPH_OP(MaxPool, ngraph::op::v1, 1)
|
NGRAPH_OP(MaxPool, ngraph::op::v1, 1)
|
||||||
NGRAPH_OP(Maximum, ngraph::op::v0, 0)
|
NGRAPH_OP(Maximum, ngraph::op::v0, 0)
|
||||||
NGRAPH_OP(Maximum, ngraph::op::v1, 1)
|
NGRAPH_OP(Maximum, ngraph::op::v1, 1)
|
||||||
NGRAPH_OP(Min, ngraph::op::v0, 0)
|
|
||||||
NGRAPH_OP(Minimum, ngraph::op::v0, 0)
|
NGRAPH_OP(Minimum, ngraph::op::v0, 0)
|
||||||
NGRAPH_OP(Minimum, ngraph::op::v1, 1)
|
NGRAPH_OP(Minimum, ngraph::op::v1, 1)
|
||||||
NGRAPH_OP(Mod, ngraph::op::v1, 1)
|
NGRAPH_OP(Mod, ngraph::op::v1, 1)
|
||||||
|
@ -21,73 +21,9 @@
|
|||||||
#include "ngraph/runtime/reference/max.hpp"
|
#include "ngraph/runtime/reference/max.hpp"
|
||||||
#include "ngraph/shape_util.hpp"
|
#include "ngraph/shape_util.hpp"
|
||||||
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ngraph;
|
using namespace ngraph;
|
||||||
|
|
||||||
constexpr NodeTypeInfo op::v0::Max::type_info;
|
|
||||||
|
|
||||||
op::v0::Max::Max(const Output<Node>& arg, const AxisSet& reduction_axes)
|
|
||||||
: ArithmeticReduction(arg, reduction_axes)
|
|
||||||
{
|
|
||||||
constructor_validate_and_infer_types();
|
|
||||||
}
|
|
||||||
|
|
||||||
op::v0::Max::Max(const Output<Node>& arg, const Output<Node>& reduction_axes)
|
|
||||||
: ArithmeticReduction(arg, reduction_axes)
|
|
||||||
{
|
|
||||||
constructor_validate_and_infer_types();
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<Node> op::v0::Max::clone_with_new_inputs(const OutputVector& new_args) const
|
|
||||||
{
|
|
||||||
check_new_args_count(this, new_args);
|
|
||||||
return make_shared<op::v0::Max>(new_args.at(0), new_args.at(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<Node> op::v0::Max::get_default_value() const
|
|
||||||
{
|
|
||||||
switch (get_element_type())
|
|
||||||
{
|
|
||||||
case element::Type_t::boolean:
|
|
||||||
return make_constant_from_string("0", get_element_type(), get_shape());
|
|
||||||
case element::Type_t::bf16:
|
|
||||||
case element::Type_t::f16:
|
|
||||||
case element::Type_t::f32:
|
|
||||||
case element::Type_t::f64:
|
|
||||||
return make_constant_from_string("-INFINITY", get_element_type(), get_shape());
|
|
||||||
case element::Type_t::i8:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<int8_t>::min()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::i16:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<int16_t>::min()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::i32:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<int32_t>::min()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::i64:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<int64_t>::min()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u8:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<uint8_t>::min()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u16:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<uint16_t>::min()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u32:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<uint32_t>::min()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u64:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<uint64_t>::min()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u1:
|
|
||||||
case element::Type_t::undefined:
|
|
||||||
case element::Type_t::dynamic:
|
|
||||||
default: throw runtime_error("Max default value not defined for type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace maxop
|
namespace maxop
|
||||||
{
|
{
|
||||||
template <element::Type_t ET>
|
template <element::Type_t ET>
|
||||||
@ -96,7 +32,7 @@ namespace maxop
|
|||||||
const AxisSet& axes,
|
const AxisSet& axes,
|
||||||
bool keep_dims)
|
bool keep_dims)
|
||||||
{
|
{
|
||||||
out->set_shape(reduce(arg->get_shape(), axes, false));
|
out->set_shape(reduce(arg->get_shape(), axes, keep_dims));
|
||||||
runtime::reference::max(
|
runtime::reference::max(
|
||||||
arg->get_data_ptr<ET>(), out->get_data_ptr<ET>(), arg->get_shape(), axes, keep_dims);
|
arg->get_data_ptr<ET>(), out->get_data_ptr<ET>(), arg->get_shape(), axes, keep_dims);
|
||||||
return true;
|
return true;
|
||||||
@ -128,12 +64,6 @@ namespace maxop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool op::v0::Max::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
|
|
||||||
{
|
|
||||||
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v0::Max::evaluate");
|
|
||||||
return maxop::evaluate_max(inputs[0], outputs[0], get_reduction_axes(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr NodeTypeInfo op::v1::ReduceMax::type_info;
|
constexpr NodeTypeInfo op::v1::ReduceMax::type_info;
|
||||||
|
|
||||||
op::v1::ReduceMax::ReduceMax(const Output<Node>& arg,
|
op::v1::ReduceMax::ReduceMax(const Output<Node>& arg,
|
||||||
|
@ -26,95 +26,39 @@ NGRAPH_SUPPRESS_DEPRECATED_START
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ngraph;
|
using namespace ngraph;
|
||||||
|
|
||||||
constexpr NodeTypeInfo op::v0::Min::type_info;
|
|
||||||
|
|
||||||
op::v0::Min::Min(const Output<Node>& arg, const AxisSet& reduction_axes)
|
|
||||||
: ArithmeticReduction(arg, reduction_axes)
|
|
||||||
{
|
|
||||||
constructor_validate_and_infer_types();
|
|
||||||
}
|
|
||||||
|
|
||||||
op::v0::Min::Min(const Output<Node>& arg, const Output<Node>& reduction_axes)
|
|
||||||
: ArithmeticReduction(arg, reduction_axes)
|
|
||||||
{
|
|
||||||
constructor_validate_and_infer_types();
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<Node> op::v0::Min::clone_with_new_inputs(const OutputVector& new_args) const
|
|
||||||
{
|
|
||||||
check_new_args_count(this, new_args);
|
|
||||||
return make_shared<op::v0::Min>(new_args.at(0), get_reduction_axes());
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<Node> op::v0::Min::get_default_value() const
|
|
||||||
{
|
|
||||||
switch (get_element_type())
|
|
||||||
{
|
|
||||||
case element::Type_t::boolean:
|
|
||||||
return make_constant_from_string("1", get_element_type(), get_shape());
|
|
||||||
case element::Type_t::bf16:
|
|
||||||
case element::Type_t::f16:
|
|
||||||
case element::Type_t::f32:
|
|
||||||
case element::Type_t::f64:
|
|
||||||
return make_constant_from_string("INFINITY", get_element_type(), get_shape());
|
|
||||||
case element::Type_t::i8:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<int8_t>::max()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::i16:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<int16_t>::max()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::i32:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<int32_t>::max()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::i64:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<int64_t>::max()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u8:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<uint8_t>::max()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u16:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<uint16_t>::max()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u32:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<uint32_t>::max()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u64:
|
|
||||||
return make_constant_from_string(
|
|
||||||
to_string(numeric_limits<uint64_t>::max()), get_element_type(), get_shape());
|
|
||||||
case element::Type_t::u1:
|
|
||||||
case element::Type_t::undefined:
|
|
||||||
case element::Type_t::dynamic:
|
|
||||||
default: throw runtime_error("Min default value not defined for type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace minop
|
namespace minop
|
||||||
{
|
{
|
||||||
template <element::Type_t ET>
|
template <element::Type_t ET>
|
||||||
bool evaluate(const HostTensorPtr& arg, const HostTensorPtr& out, const AxisSet& axes)
|
bool evaluate(const HostTensorPtr& arg,
|
||||||
|
const HostTensorPtr& out,
|
||||||
|
const AxisSet& axes,
|
||||||
|
bool keep_dims)
|
||||||
{
|
{
|
||||||
out->set_shape(reduce(arg->get_shape(), axes, false));
|
out->set_shape(reduce(arg->get_shape(), axes, keep_dims));
|
||||||
runtime::reference::min(
|
runtime::reference::min(
|
||||||
arg->get_data_ptr<ET>(), out->get_data_ptr<ET>(), arg->get_shape(), axes);
|
arg->get_data_ptr<ET>(), out->get_data_ptr<ET>(), arg->get_shape(), axes);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool evaluate_min(const HostTensorPtr& arg, const HostTensorPtr& out, const AxisSet& axes)
|
bool evaluate_min(const HostTensorPtr& arg,
|
||||||
|
const HostTensorPtr& out,
|
||||||
|
const AxisSet& axes,
|
||||||
|
bool keep_dims)
|
||||||
{
|
{
|
||||||
bool rc = true;
|
bool rc = true;
|
||||||
switch (arg->get_element_type())
|
switch (arg->get_element_type())
|
||||||
{
|
{
|
||||||
TYPE_CASE(i32)(arg, out, axes);
|
TYPE_CASE(i32)(arg, out, axes, keep_dims);
|
||||||
break;
|
break;
|
||||||
TYPE_CASE(i64)(arg, out, axes);
|
TYPE_CASE(i64)(arg, out, axes, keep_dims);
|
||||||
break;
|
break;
|
||||||
TYPE_CASE(u32)(arg, out, axes);
|
TYPE_CASE(u32)(arg, out, axes, keep_dims);
|
||||||
break;
|
break;
|
||||||
TYPE_CASE(u64)(arg, out, axes);
|
TYPE_CASE(u64)(arg, out, axes, keep_dims);
|
||||||
break;
|
break;
|
||||||
TYPE_CASE(f16)(arg, out, axes);
|
TYPE_CASE(f16)(arg, out, axes, keep_dims);
|
||||||
break;
|
break;
|
||||||
TYPE_CASE(f32)(arg, out, axes);
|
TYPE_CASE(f32)(arg, out, axes, keep_dims);
|
||||||
break;
|
break;
|
||||||
default: rc = false; break;
|
default: rc = false; break;
|
||||||
}
|
}
|
||||||
@ -122,12 +66,6 @@ namespace minop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool op::v0::Min::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
|
|
||||||
{
|
|
||||||
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v0::Min::evaluate");
|
|
||||||
return minop::evaluate_min(inputs[0], outputs[0], get_reduction_axes());
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr NodeTypeInfo op::v1::ReduceMin::type_info;
|
constexpr NodeTypeInfo op::v1::ReduceMin::type_info;
|
||||||
|
|
||||||
op::v1::ReduceMin::ReduceMin(const Output<Node>& arg,
|
op::v1::ReduceMin::ReduceMin(const Output<Node>& arg,
|
||||||
@ -148,5 +86,5 @@ bool op::v1::ReduceMin::evaluate(const HostTensorVector& outputs,
|
|||||||
const HostTensorVector& inputs) const
|
const HostTensorVector& inputs) const
|
||||||
{
|
{
|
||||||
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v1::ReduceMin::evaluate");
|
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v1::ReduceMin::evaluate");
|
||||||
return minop::evaluate_min(inputs[0], outputs[0], get_reduction_axes());
|
return minop::evaluate_min(inputs[0], outputs[0], get_reduction_axes(), get_keep_dims());
|
||||||
}
|
}
|
||||||
|
@ -43,15 +43,7 @@ static shared_ptr<op::Constant>
|
|||||||
runtime::AlignedBuffer buffer(shape_size(out_shape) * sizeof(T));
|
runtime::AlignedBuffer buffer(shape_size(out_shape) * sizeof(T));
|
||||||
T* data_ptr = buffer.get_ptr<T>();
|
T* data_ptr = buffer.get_ptr<T>();
|
||||||
|
|
||||||
if (auto max = as_type_ptr<op::Max>(reduction_node))
|
if (auto reduce_max = as_type_ptr<op::v1::ReduceMax>(reduction_node))
|
||||||
{
|
|
||||||
runtime::reference::max<T>(constant->get_data_ptr<T>(),
|
|
||||||
data_ptr,
|
|
||||||
constant->get_output_shape(0),
|
|
||||||
max->get_reduction_axes(),
|
|
||||||
false);
|
|
||||||
}
|
|
||||||
else if (auto reduce_max = as_type_ptr<op::v1::ReduceMax>(reduction_node))
|
|
||||||
{
|
{
|
||||||
runtime::reference::max<T>(constant->get_data_ptr<T>(),
|
runtime::reference::max<T>(constant->get_data_ptr<T>(),
|
||||||
data_ptr,
|
data_ptr,
|
||||||
@ -59,13 +51,6 @@ static shared_ptr<op::Constant>
|
|||||||
reduce_max->get_reduction_axes(),
|
reduce_max->get_reduction_axes(),
|
||||||
reduce_max->get_keep_dims());
|
reduce_max->get_keep_dims());
|
||||||
}
|
}
|
||||||
else if (auto min = as_type_ptr<op::Min>(reduction_node))
|
|
||||||
{
|
|
||||||
runtime::reference::min<T>(constant->get_data_ptr<T>(),
|
|
||||||
data_ptr,
|
|
||||||
constant->get_output_shape(0),
|
|
||||||
min->get_reduction_axes());
|
|
||||||
}
|
|
||||||
else if (auto reduce_min = as_type_ptr<op::v1::ReduceMin>(reduction_node))
|
else if (auto reduce_min = as_type_ptr<op::v1::ReduceMin>(reduction_node))
|
||||||
{
|
{
|
||||||
runtime::reference::min<T>(constant->get_data_ptr<T>(),
|
runtime::reference::min<T>(constant->get_data_ptr<T>(),
|
||||||
@ -174,8 +159,7 @@ void pass::ConstantFolding::construct_constant_arithmetic_reduction()
|
|||||||
auto constant_axes_label =
|
auto constant_axes_label =
|
||||||
make_shared<pattern::op::Label>(element::i64, Shape{2}, pattern::has_class<op::Constant>());
|
make_shared<pattern::op::Label>(element::i64, Shape{2}, pattern::has_class<op::Constant>());
|
||||||
auto is_supported_reduction = [](std::shared_ptr<Node> n) {
|
auto is_supported_reduction = [](std::shared_ptr<Node> n) {
|
||||||
return (pattern::has_class<op::Max>()(n) || pattern::has_class<op::Min>()(n) ||
|
return (pattern::has_class<op::Sum>()(n) || pattern::has_class<op::v1::ReduceMax>()(n) ||
|
||||||
pattern::has_class<op::Sum>()(n) || pattern::has_class<op::v1::ReduceMax>()(n) ||
|
|
||||||
pattern::has_class<op::v1::ReduceMin>()(n) ||
|
pattern::has_class<op::v1::ReduceMin>()(n) ||
|
||||||
pattern::has_class<op::v1::ReduceProd>()(n) ||
|
pattern::has_class<op::v1::ReduceProd>()(n) ||
|
||||||
pattern::has_class<op::v1::ReduceSum>()(n) ||
|
pattern::has_class<op::v1::ReduceSum>()(n) ||
|
||||||
|
@ -301,9 +301,7 @@ set(MULTI_TEST_SRC
|
|||||||
backend/logical_xor.in.cpp
|
backend/logical_xor.in.cpp
|
||||||
backend/lrn.in.cpp
|
backend/lrn.in.cpp
|
||||||
backend/matmul.in.cpp
|
backend/matmul.in.cpp
|
||||||
backend/max.in.cpp
|
|
||||||
backend/maximum.in.cpp
|
backend/maximum.in.cpp
|
||||||
backend/min.in.cpp
|
|
||||||
backend/minimum.in.cpp
|
backend/minimum.in.cpp
|
||||||
backend/multiple_backends.in.cpp
|
backend/multiple_backends.in.cpp
|
||||||
backend/multiple_result.in.cpp
|
backend/multiple_result.in.cpp
|
||||||
|
@ -1,366 +0,0 @@
|
|||||||
//*****************************************************************************
|
|
||||||
// Copyright 2017-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.
|
|
||||||
//*****************************************************************************
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "ngraph/ngraph.hpp"
|
|
||||||
#include "util/engine/test_engines.hpp"
|
|
||||||
#include "util/test_case.hpp"
|
|
||||||
#include "util/test_control.hpp"
|
|
||||||
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace ngraph;
|
|
||||||
|
|
||||||
static string s_manifest = "${MANIFEST}";
|
|
||||||
using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME});
|
|
||||||
|
|
||||||
// Trivial case with no reduced axes.
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_trivial)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape, {1, 2, 3, 4});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_trivial_int8)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i8, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int8_t> a{1, 2, 3, 4};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int8_t>({a});
|
|
||||||
test_case.add_expected_output<int8_t>(shape, {1, 2, 3, 4});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Failure has been reported at 5D for some reason
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_trivial_5d)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2, 2, 2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_trivial_5d_int32)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2, 2, 2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i32, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int32_t> a{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int32_t>({a});
|
|
||||||
test_case.add_expected_output<int32_t>(shape, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_to_scalar)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0, 1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>(a);
|
|
||||||
test_case.add_expected_output<float>(Shape{}, {4});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_to_scalar_int8)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i8, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0, 1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int8_t> a{1, 2, 3, 4};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int8_t>({a});
|
|
||||||
test_case.add_expected_output<int8_t>(shape, {4});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_matrix_columns)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{2};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {5, 6});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_matrix_rows)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {2, 4, 6});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_matrix_rows_int32)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i32, shape_a);
|
|
||||||
Shape shape_rt{3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int32_t> a{1, 2, 3, 4, 5, 6};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int32_t>({a});
|
|
||||||
test_case.add_expected_output<int32_t>(shape_rt, {2, 4, 6});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_matrix_rows_zero)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 0};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt,
|
|
||||||
{-std::numeric_limits<float>::infinity(),
|
|
||||||
-std::numeric_limits<float>::infinity(),
|
|
||||||
-std::numeric_limits<float>::infinity()});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_matrix_rows_zero_int32)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 0};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i32, shape_a);
|
|
||||||
Shape shape_rt{3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int32_t> a{};
|
|
||||||
|
|
||||||
int32_t minval = std::numeric_limits<int32_t>::has_infinity
|
|
||||||
? -std::numeric_limits<int32_t>::infinity()
|
|
||||||
: std::numeric_limits<int32_t>::min();
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int32_t>({a});
|
|
||||||
test_case.add_expected_output<int32_t>(shape_rt, {minval, minval, minval});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_matrix_cols_zero)
|
|
||||||
{
|
|
||||||
// Now the reduction (g(x:float32[2,2],y:float32[]) = reduce(x,y,f,axes={})).
|
|
||||||
Shape shape_a{0, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{2};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(
|
|
||||||
shape_rt,
|
|
||||||
{-std::numeric_limits<float>::infinity(), -std::numeric_limits<float>::infinity()});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_vector_zero)
|
|
||||||
{
|
|
||||||
Shape shape_a{0};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {-std::numeric_limits<float>::infinity()});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_matrix_to_scalar_zero_by_zero)
|
|
||||||
{
|
|
||||||
Shape shape_a{0, 0};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0, 1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {-std::numeric_limits<float>::infinity()});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_3d_to_matrix_most_sig)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3, 3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {19, 20, 21, 22, 23, 24, 25, 26, 27});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_3d_to_matrix_least_sig)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3, 3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{2}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {3, 6, 9, 12, 15, 18, 21, 24, 27});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_3d_to_vector)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0, 1}), ParameterVector{A});
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {25.0f, 26.0f, 27.0f});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_3d_to_scalar)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0, 1, 2}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {14.0f});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_3d_to_scalar_int32)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i32, shape_a);
|
|
||||||
Shape shape_rt{};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0, 1, 2}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int32_t> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int32_t>({a});
|
|
||||||
test_case.add_expected_output<int32_t>(shape_rt, {14});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_3d_to_scalar_double)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f64, shape_a);
|
|
||||||
Shape shape_rt{};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{0, 1, 2}), ParameterVector{A});
|
|
||||||
|
|
||||||
std:
|
|
||||||
vector<double> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<double>({a});
|
|
||||||
test_case.add_expected_output<double>(shape_rt, {14});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, max_3d_eliminate_zero_dim)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 0, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3, 2};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Max>(A, AxisSet{1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt,
|
|
||||||
{-std::numeric_limits<float>::infinity(),
|
|
||||||
-std::numeric_limits<float>::infinity(),
|
|
||||||
-std::numeric_limits<float>::infinity(),
|
|
||||||
-std::numeric_limits<float>::infinity(),
|
|
||||||
-std::numeric_limits<float>::infinity(),
|
|
||||||
-std::numeric_limits<float>::infinity()});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
@ -1,311 +0,0 @@
|
|||||||
//*****************************************************************************
|
|
||||||
// Copyright 2017-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.
|
|
||||||
//*****************************************************************************
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "ngraph/ngraph.hpp"
|
|
||||||
#include "util/engine/test_engines.hpp"
|
|
||||||
#include "util/test_case.hpp"
|
|
||||||
#include "util/test_control.hpp"
|
|
||||||
|
|
||||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace ngraph;
|
|
||||||
|
|
||||||
static string s_manifest = "${MANIFEST}";
|
|
||||||
using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME});
|
|
||||||
|
|
||||||
// Trivial case with no reduced axes.
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_trivial)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape, {1, 2, 3, 4});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Failure has been reported at 5D for some reason
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_trivial_5d)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2, 2, 2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{}), ParameterVector{A});
|
|
||||||
std::vector<float> a{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_trivial_5d_int32)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2, 2, 2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i32, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int32_t> a{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int32_t>({a});
|
|
||||||
test_case.add_expected_output<int32_t>(shape, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_to_scalar)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0, 1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(Shape{}, {1});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_to_scalar_int8)
|
|
||||||
{
|
|
||||||
Shape shape{2, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i8, shape);
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0, 1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int8_t> a{1, 2, 3, 4};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int8_t>({a});
|
|
||||||
test_case.add_expected_output<int8_t>(Shape{}, {1});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_matrix_columns)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{2};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {1, 2});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_matrix_rows)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {1, 3, 5});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_matrix_rows_int32)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i32, shape_a);
|
|
||||||
Shape shape_rt{3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int32_t> a{1, 2, 3, 4, 5, 6};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int32_t>({a});
|
|
||||||
test_case.add_expected_output<int32_t>(shape_rt, {1, 3, 5});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_matrix_rows_zero)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 0};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt,
|
|
||||||
{std::numeric_limits<float>::infinity(),
|
|
||||||
std::numeric_limits<float>::infinity(),
|
|
||||||
std::numeric_limits<float>::infinity()});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_matrix_cols_zero)
|
|
||||||
{
|
|
||||||
// Now the reduction (g(x:float32[2,2],y:float32[]) = reduce(x,y,f,axes={})).
|
|
||||||
Shape shape_a{0, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{2};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(
|
|
||||||
shape_rt, {std::numeric_limits<float>::infinity(), std::numeric_limits<float>::infinity()});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_vector_zero)
|
|
||||||
{
|
|
||||||
Shape shape_a{0};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {std::numeric_limits<float>::infinity()});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_matrix_to_scalar_zero_by_zero)
|
|
||||||
{
|
|
||||||
Shape shape_a{0, 0};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0, 1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {std::numeric_limits<float>::infinity()});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_3d_to_matrix_most_sig)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3, 3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {1, 2, 3, 4, 5, 6, 7, 8, 9});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_3d_to_matrix_least_sig)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3, 3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{2}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {1, 4, 7, 10, 13, 16, 19, 22, 25});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_3d_to_vector)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0, 1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {1, 2, 3});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_3d_to_scalar)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0, 1, 2}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {1});
|
|
||||||
test_case.run(MIN_FLOAT_TOLERANCE_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_3d_to_scalar_int32)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 3, 3};
|
|
||||||
auto A = make_shared<op::Parameter>(element::i32, shape_a);
|
|
||||||
Shape shape_rt{};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{0, 1, 2}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<int32_t> a{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<int32_t>({a});
|
|
||||||
test_case.add_expected_output<int32_t>(shape_rt, {1});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
NGRAPH_TEST(${BACKEND_NAME}, min_3d_eliminate_zero_dim)
|
|
||||||
{
|
|
||||||
Shape shape_a{3, 0, 2};
|
|
||||||
auto A = make_shared<op::Parameter>(element::f32, shape_a);
|
|
||||||
Shape shape_rt{3, 2};
|
|
||||||
auto f = make_shared<Function>(make_shared<op::Min>(A, AxisSet{1}), ParameterVector{A});
|
|
||||||
|
|
||||||
std::vector<float> a{};
|
|
||||||
|
|
||||||
float inf = std::numeric_limits<float>::infinity();
|
|
||||||
|
|
||||||
auto test_case = test::TestCase<TestEngine>(f);
|
|
||||||
test_case.add_input<float>({a});
|
|
||||||
test_case.add_expected_output<float>(shape_rt, {inf, inf, inf, inf, inf, inf});
|
|
||||||
test_case.run();
|
|
||||||
}
|
|
@ -991,34 +991,6 @@ TEST(constant_folding, const_reducesum_keepdims)
|
|||||||
ASSERT_EQ(values_expected, values_out);
|
ASSERT_EQ(values_expected, values_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(constant_folding, const_max)
|
|
||||||
{
|
|
||||||
Shape input_shape{3, 3};
|
|
||||||
|
|
||||||
vector<int32_t> values_in{1, 2, 3, 4, 5, 6, 7, 8, 9};
|
|
||||||
auto constant = op::Constant::create(element::i32, input_shape, values_in);
|
|
||||||
auto convert = make_shared<op::Max>(constant, AxisSet{1});
|
|
||||||
convert->set_friendly_name("test");
|
|
||||||
auto f = make_shared<Function>(convert, ParameterVector{});
|
|
||||||
|
|
||||||
pass::Manager pass_manager;
|
|
||||||
pass_manager.register_pass<pass::ConstantFolding>();
|
|
||||||
pass_manager.run_passes(f);
|
|
||||||
|
|
||||||
ASSERT_EQ(count_ops_of_type<op::Max>(f), 0);
|
|
||||||
ASSERT_EQ(count_ops_of_type<op::Constant>(f), 1);
|
|
||||||
|
|
||||||
auto new_const =
|
|
||||||
as_type_ptr<op::Constant>(f->get_results().at(0)->input_value(0).get_node_shared_ptr());
|
|
||||||
ASSERT_TRUE(new_const);
|
|
||||||
ASSERT_EQ(new_const->get_friendly_name(), "test");
|
|
||||||
auto values_out = new_const->get_vector<int32_t>();
|
|
||||||
|
|
||||||
vector<int32_t> values_expected{3, 6, 9};
|
|
||||||
|
|
||||||
ASSERT_EQ(values_expected, values_out);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(constant_folding, const_reducemax)
|
TEST(constant_folding, const_reducemax)
|
||||||
{
|
{
|
||||||
Shape input_shape{3, 2};
|
Shape input_shape{3, 2};
|
||||||
@ -1087,34 +1059,6 @@ TEST(constant_folding, const_reducemax_keepdims)
|
|||||||
ASSERT_EQ(values_expected, values_out);
|
ASSERT_EQ(values_expected, values_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(constant_folding, const_min)
|
|
||||||
{
|
|
||||||
Shape input_shape{3, 3};
|
|
||||||
|
|
||||||
vector<int32_t> values_in{1, 2, 3, 4, 5, 6, 7, 8, 9};
|
|
||||||
auto constant = op::Constant::create(element::i32, input_shape, values_in);
|
|
||||||
auto convert = make_shared<op::Min>(constant, AxisSet{1});
|
|
||||||
convert->set_friendly_name("test");
|
|
||||||
auto f = make_shared<Function>(convert, ParameterVector{});
|
|
||||||
|
|
||||||
pass::Manager pass_manager;
|
|
||||||
pass_manager.register_pass<pass::ConstantFolding>();
|
|
||||||
pass_manager.run_passes(f);
|
|
||||||
|
|
||||||
ASSERT_EQ(count_ops_of_type<op::Min>(f), 0);
|
|
||||||
ASSERT_EQ(count_ops_of_type<op::Constant>(f), 1);
|
|
||||||
|
|
||||||
auto new_const =
|
|
||||||
as_type_ptr<op::Constant>(f->get_results().at(0)->input_value(0).get_node_shared_ptr());
|
|
||||||
ASSERT_TRUE(new_const);
|
|
||||||
ASSERT_EQ(new_const->get_friendly_name(), "test");
|
|
||||||
auto values_out = new_const->get_vector<int32_t>();
|
|
||||||
|
|
||||||
vector<int32_t> values_expected{1, 4, 7};
|
|
||||||
|
|
||||||
ASSERT_EQ(values_expected, values_out);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(constant_folding, const_reducemin)
|
TEST(constant_folding, const_reducemin)
|
||||||
{
|
{
|
||||||
Shape input_shape{3, 2};
|
Shape input_shape{3, 2};
|
||||||
|
@ -479,15 +479,6 @@ namespace
|
|||||||
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
|
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
|
||||||
}
|
}
|
||||||
|
|
||||||
void op_is_Max()
|
|
||||||
{
|
|
||||||
op::Max node;
|
|
||||||
EXPECT_FALSE(op::is_unary_elementwise_arithmetic(&node));
|
|
||||||
EXPECT_FALSE(op::is_binary_elementwise_arithmetic(&node));
|
|
||||||
EXPECT_FALSE(op::is_binary_elementwise_comparison(&node));
|
|
||||||
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
|
|
||||||
}
|
|
||||||
|
|
||||||
void op_is_Maximum()
|
void op_is_Maximum()
|
||||||
{
|
{
|
||||||
op::Maximum node;
|
op::Maximum node;
|
||||||
@ -497,15 +488,6 @@ namespace
|
|||||||
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
|
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
|
||||||
}
|
}
|
||||||
|
|
||||||
void op_is_Min()
|
|
||||||
{
|
|
||||||
op::Min node;
|
|
||||||
EXPECT_FALSE(op::is_unary_elementwise_arithmetic(&node));
|
|
||||||
EXPECT_FALSE(op::is_binary_elementwise_arithmetic(&node));
|
|
||||||
EXPECT_FALSE(op::is_binary_elementwise_comparison(&node));
|
|
||||||
EXPECT_FALSE(op::is_binary_elementwise_logical(&node));
|
|
||||||
}
|
|
||||||
|
|
||||||
void op_is_Minimum()
|
void op_is_Minimum()
|
||||||
{
|
{
|
||||||
op::Minimum node;
|
op::Minimum node;
|
||||||
|
@ -1519,9 +1519,7 @@ protected:
|
|||||||
case OP_TYPEID::LogicalOr_v1:
|
case OP_TYPEID::LogicalOr_v1:
|
||||||
case OP_TYPEID::LogicalXor_v1:
|
case OP_TYPEID::LogicalXor_v1:
|
||||||
case OP_TYPEID::MatMul:
|
case OP_TYPEID::MatMul:
|
||||||
case OP_TYPEID::Max:
|
|
||||||
case OP_TYPEID::Maximum:
|
case OP_TYPEID::Maximum:
|
||||||
case OP_TYPEID::Min:
|
|
||||||
case OP_TYPEID::Minimum:
|
case OP_TYPEID::Minimum:
|
||||||
case OP_TYPEID::Multiply:
|
case OP_TYPEID::Multiply:
|
||||||
case OP_TYPEID::NonZero_v3:
|
case OP_TYPEID::NonZero_v3:
|
||||||
|
@ -93,9 +93,7 @@ NGRAPH_OP(LRN, ngraph::op)
|
|||||||
NGRAPH_OP(LSTMSequence, ngraph::op::v0)
|
NGRAPH_OP(LSTMSequence, ngraph::op::v0)
|
||||||
NGRAPH_OP(MatMul, ngraph::op)
|
NGRAPH_OP(MatMul, ngraph::op)
|
||||||
NGRAPH_OP(NormalizeL2, ngraph::op)
|
NGRAPH_OP(NormalizeL2, ngraph::op)
|
||||||
NGRAPH_OP(Max, ngraph::op)
|
|
||||||
NGRAPH_OP(Maximum, ngraph::op)
|
NGRAPH_OP(Maximum, ngraph::op)
|
||||||
NGRAPH_OP(Min, ngraph::op)
|
|
||||||
NGRAPH_OP(Minimum, ngraph::op)
|
NGRAPH_OP(Minimum, ngraph::op)
|
||||||
NGRAPH_OP(Multiply, ngraph::op)
|
NGRAPH_OP(Multiply, ngraph::op)
|
||||||
NGRAPH_OP(MVN, ngraph::op)
|
NGRAPH_OP(MVN, ngraph::op)
|
||||||
|
@ -343,13 +343,6 @@ namespace opset0_downgrade
|
|||||||
return op_cast_binary_elementwise_node<op::v0::Power, op::v1::Power>(node);
|
return op_cast_binary_elementwise_node<op::v0::Power, op::v1::Power>(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<Node> op_cast(shared_ptr<op::v1::ReduceMax> node)
|
|
||||||
{
|
|
||||||
auto replacement_node = op_cast_reduction_node<op::v0::Max, op::v1::ReduceMax>(node);
|
|
||||||
replace_node(node, replacement_node);
|
|
||||||
return replacement_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<Node> op_cast(shared_ptr<op::v1::ReduceMean> node)
|
shared_ptr<Node> op_cast(shared_ptr<op::v1::ReduceMean> node)
|
||||||
{
|
{
|
||||||
// ReduceMean = Sum / Count
|
// ReduceMean = Sum / Count
|
||||||
@ -383,13 +376,6 @@ namespace opset0_downgrade
|
|||||||
return replacement_node;
|
return replacement_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<Node> op_cast(shared_ptr<op::v1::ReduceMin> node)
|
|
||||||
{
|
|
||||||
auto replacement_node = op_cast_reduction_node<op::v0::Min, op::v1::ReduceMin>(node);
|
|
||||||
replace_node(node, replacement_node);
|
|
||||||
return replacement_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<Node> op_cast(shared_ptr<op::v1::ReduceSum> node)
|
shared_ptr<Node> op_cast(shared_ptr<op::v1::ReduceSum> node)
|
||||||
{
|
{
|
||||||
auto replacement_node = op_cast_reduction_node<op::v0::Sum, op::v1::ReduceSum>(node);
|
auto replacement_node = op_cast_reduction_node<op::v0::Sum, op::v1::ReduceSum>(node);
|
||||||
|
@ -257,29 +257,11 @@ namespace opset1_upgrade
|
|||||||
return op_cast_binary_elementwise_node<op::v0::LessEq, op::v1::LessEqual>(node);
|
return op_cast_binary_elementwise_node<op::v0::LessEq, op::v1::LessEqual>(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<Node> op_cast(shared_ptr<op::Max> node)
|
|
||||||
{
|
|
||||||
bool keep_dims = false;
|
|
||||||
auto replacement_node =
|
|
||||||
make_shared<op::v1::ReduceMax>(node->input_value(0), node->input_value(1), keep_dims);
|
|
||||||
replace_node(node, replacement_node);
|
|
||||||
return replacement_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<Node> op_cast(shared_ptr<op::Maximum> node)
|
shared_ptr<Node> op_cast(shared_ptr<op::Maximum> node)
|
||||||
{
|
{
|
||||||
return op_cast_binary_elementwise_node<op::v0::Maximum, op::v1::Maximum>(node);
|
return op_cast_binary_elementwise_node<op::v0::Maximum, op::v1::Maximum>(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<Node> op_cast(shared_ptr<op::Min> node)
|
|
||||||
{
|
|
||||||
bool keep_dims = false;
|
|
||||||
auto replacement_node =
|
|
||||||
make_shared<op::v1::ReduceMin>(node->input_value(0), node->input_value(1), keep_dims);
|
|
||||||
replace_node(node, replacement_node);
|
|
||||||
return replacement_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
shared_ptr<Node> op_cast(shared_ptr<op::Minimum> node)
|
shared_ptr<Node> op_cast(shared_ptr<op::Minimum> node)
|
||||||
{
|
{
|
||||||
return op_cast_binary_elementwise_node<op::v0::Minimum, op::v1::Minimum>(node);
|
return op_cast_binary_elementwise_node<op::v0::Minimum, op::v1::Minimum>(node);
|
||||||
|
Loading…
Reference in New Issue
Block a user