Remove obsoleted v0::Gather and v0::GatherND (#2826)
This commit is contained in:
parent
c6fc247f99
commit
73c40722fd
|
|
@ -22,43 +22,6 @@ namespace ngraph
|
|||
{
|
||||
namespace op
|
||||
{
|
||||
namespace v0
|
||||
{
|
||||
/// \brief Gather slices from axis of params according to indices
|
||||
class NGRAPH_DEPRECATED(
|
||||
"This operation is deprecated and will be removed soon. "
|
||||
"Use v1::Gather instead of it.") NGRAPH_API Gather : public Op
|
||||
{
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
public:
|
||||
static constexpr NodeTypeInfo type_info{"Gather", 0};
|
||||
const NodeTypeInfo& get_type_info() const override { return type_info; }
|
||||
Gather() = default;
|
||||
/// \param params The tensor from which slices are gathered
|
||||
/// \param indices Index tensor: Data type must be `element::i32` or `element::i64`
|
||||
/// \param axis Axis in params to gather
|
||||
Gather(const Output<Node>& params, const Output<Node>& indices, size_t axis = 0);
|
||||
|
||||
void validate_and_infer_types() override;
|
||||
|
||||
size_t get_axis() const { return m_axis; }
|
||||
void set_axis(size_t axis) { m_axis = axis; }
|
||||
virtual std::shared_ptr<Node>
|
||||
clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
bool evaluate(const HostTensorVector& outputs,
|
||||
const HostTensorVector& inputs) const override;
|
||||
|
||||
protected:
|
||||
size_t m_axis;
|
||||
|
||||
private:
|
||||
static const int PARAMS;
|
||||
static const int INDICES;
|
||||
static const int AXIS;
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
};
|
||||
}
|
||||
|
||||
namespace v1
|
||||
{
|
||||
/// \brief Gather slices from axis of params according to indices
|
||||
|
|
@ -93,10 +56,5 @@ namespace ngraph
|
|||
static const int AXIS;
|
||||
};
|
||||
}
|
||||
|
||||
// latest stable opset version
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
using v0::Gather;
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,40 +22,6 @@ namespace ngraph
|
|||
{
|
||||
namespace op
|
||||
{
|
||||
namespace v0
|
||||
{
|
||||
/// \brief Gather slices from params with shapes given by indices
|
||||
class NGRAPH_DEPRECATED(
|
||||
"This operation is deprecated and will be removed soon. Please do not use it.")
|
||||
NGRAPH_API GatherND : public Op
|
||||
{
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
public:
|
||||
static constexpr NodeTypeInfo type_info{"GatherND", 0};
|
||||
const NodeTypeInfo& get_type_info() const override { return type_info; }
|
||||
GatherND() = default;
|
||||
/// \param params The tensor from which slices are gathered
|
||||
/// \param indices Index tensor: Data type must be `element::i32` or `element::i64`
|
||||
GatherND(const Output<Node>& params, const Output<Node>& indices)
|
||||
: Op({params, indices})
|
||||
{
|
||||
constructor_validate_and_infer_types();
|
||||
}
|
||||
|
||||
void validate_and_infer_types() override;
|
||||
virtual std::shared_ptr<Node>
|
||||
clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
|
||||
private:
|
||||
static const int PARAMS;
|
||||
static const int INDICES;
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
};
|
||||
}
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
using v0::GatherND;
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
namespace v5
|
||||
{
|
||||
/// \brief GatherND operation
|
||||
|
|
|
|||
|
|
@ -77,9 +77,8 @@ NGRAPH_OP(Floor, ngraph::op::v0, 0)
|
|||
NGRAPH_OP(FloorMod, ngraph::op::v1, 1)
|
||||
NGRAPH_OP(GRN, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(GRUCell, ngraph::op::v3, 3)
|
||||
NGRAPH_OP(Gather, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(Gather, ngraph::op::v1, 1)
|
||||
NGRAPH_OP(GatherND, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(GatherND, ngraph::op::v5, 5)
|
||||
NGRAPH_OP(GatherTree, ngraph::op::v1, 1)
|
||||
NGRAPH_OP(Gelu, ngraph::op::v0, 0)
|
||||
NGRAPH_OP(Greater, ngraph::op::v0, 0)
|
||||
|
|
|
|||
|
|
@ -28,75 +28,6 @@ NGRAPH_SUPPRESS_DEPRECATED_START
|
|||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
const int op::v0::Gather::PARAMS = 0;
|
||||
const int op::v0::Gather::INDICES = 1;
|
||||
const int op::v0::Gather::AXIS = 2;
|
||||
|
||||
constexpr NodeTypeInfo op::v0::Gather::type_info;
|
||||
|
||||
op::v0::Gather::Gather(const Output<Node>& params, const Output<Node>& indices, size_t axis)
|
||||
: Op({params, indices})
|
||||
, m_axis(axis)
|
||||
{
|
||||
constructor_validate_and_infer_types();
|
||||
}
|
||||
|
||||
shared_ptr<Node> op::v0::Gather::clone_with_new_inputs(const OutputVector& new_args) const
|
||||
{
|
||||
check_new_args_count(this, new_args);
|
||||
return make_shared<v0::Gather>(new_args.at(PARAMS), new_args.at(INDICES), m_axis);
|
||||
}
|
||||
|
||||
void op::v0::Gather::validate_and_infer_types()
|
||||
{
|
||||
element::Type result_et = get_input_element_type(PARAMS);
|
||||
element::Type indices_et = get_input_element_type(INDICES);
|
||||
|
||||
const PartialShape& params_shape = get_input_partial_shape(PARAMS);
|
||||
const PartialShape& indices_shape = get_input_partial_shape(INDICES);
|
||||
|
||||
NODE_VALIDATION_CHECK(this,
|
||||
indices_et == element::i32 || indices_et == element::i64,
|
||||
"Indices element type must be i64 or i32");
|
||||
|
||||
// params rank must be at least (axis + 1)
|
||||
// indices value must be in range [0, params.shape[axis]).
|
||||
// output rank is rank(params) + rank(indices) - 1
|
||||
NODE_VALIDATION_CHECK(this,
|
||||
params_shape.rank().is_dynamic() ||
|
||||
params_shape.rank().get_length() > static_cast<size_t>(m_axis),
|
||||
"params rank is expected to be at least axis + 1");
|
||||
|
||||
PartialShape result_shape;
|
||||
if (params_shape.rank().is_static() && indices_shape.rank().is_static())
|
||||
{
|
||||
std::vector<Dimension> result_dims(params_shape.rank().get_length() +
|
||||
indices_shape.rank().get_length() - 1);
|
||||
size_t i = 0;
|
||||
for (; i < static_cast<size_t>(m_axis); i++)
|
||||
{
|
||||
result_dims[i] = params_shape[i];
|
||||
}
|
||||
for (size_t j = 0; j < indices_shape.rank().get_length(); i++, j++)
|
||||
{
|
||||
result_dims[i] = indices_shape[j];
|
||||
}
|
||||
for (size_t j = static_cast<size_t>(m_axis) + 1; j < params_shape.rank().get_length();
|
||||
i++, j++)
|
||||
{
|
||||
result_dims[i] = params_shape[j];
|
||||
}
|
||||
|
||||
result_shape = PartialShape(result_dims);
|
||||
}
|
||||
else
|
||||
{
|
||||
result_shape = PartialShape::dynamic();
|
||||
}
|
||||
|
||||
set_output_type(0, result_et, result_shape);
|
||||
}
|
||||
|
||||
constexpr NodeTypeInfo op::v1::Gather::type_info;
|
||||
const int64_t op::v1::Gather::AXIS_NOT_SET_VALUE;
|
||||
|
||||
|
|
@ -291,12 +222,6 @@ namespace gather
|
|||
}
|
||||
}
|
||||
|
||||
bool op::v0::Gather::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
|
||||
{
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v0::Gather::evaluate");
|
||||
return gather::evaluate_gather(inputs[0], inputs[1], outputs[0], get_axis());
|
||||
}
|
||||
|
||||
bool op::v1::Gather::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const
|
||||
{
|
||||
OV_ITT_SCOPED_TASK(itt::domains::nGraphOp, "op::v1::Gather::evaluate");
|
||||
|
|
|
|||
|
|
@ -157,73 +157,3 @@ shared_ptr<Node> op::v5::GatherND::clone_with_new_inputs(const OutputVector& new
|
|||
check_new_args_count(this, new_args);
|
||||
return make_shared<op::v5::GatherND>(new_args.at(0), new_args.at(1), m_batch_dims);
|
||||
}
|
||||
|
||||
// ------------------------------ V0 ------------------------------
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
|
||||
const int op::GatherND::PARAMS = 0;
|
||||
const int op::GatherND::INDICES = 1;
|
||||
|
||||
constexpr NodeTypeInfo op::GatherND::type_info;
|
||||
|
||||
shared_ptr<Node> op::GatherND::clone_with_new_inputs(const OutputVector& new_args) const
|
||||
{
|
||||
check_new_args_count(this, new_args);
|
||||
return make_shared<GatherND>(new_args.at(PARAMS), new_args.at(INDICES));
|
||||
}
|
||||
|
||||
void op::GatherND::validate_and_infer_types()
|
||||
{
|
||||
element::Type result_et = get_input_element_type(PARAMS);
|
||||
element::Type indices_et = get_input_element_type(INDICES);
|
||||
|
||||
const PartialShape& params_shape = get_input_partial_shape(PARAMS);
|
||||
const PartialShape& indices_shape = get_input_partial_shape(INDICES);
|
||||
|
||||
NODE_VALIDATION_CHECK(this,
|
||||
indices_et == element::i32 || indices_et == element::i64,
|
||||
"Indices element type must be i64 or i32");
|
||||
|
||||
NODE_VALIDATION_CHECK(this,
|
||||
indices_shape.rank().is_dynamic() ||
|
||||
indices_shape.rank().get_length() >= 1,
|
||||
"indices rank is expected to be at least 1");
|
||||
|
||||
NODE_VALIDATION_CHECK(this,
|
||||
params_shape.rank().is_dynamic() || params_shape.rank().get_length() >= 1,
|
||||
"params rank is expected to be at least 1");
|
||||
|
||||
NODE_VALIDATION_CHECK(this,
|
||||
params_shape.rank().is_dynamic() || indices_shape.rank().is_dynamic() ||
|
||||
indices_shape[indices_shape.rank().get_length() - 1].get_length() <=
|
||||
params_shape.rank().get_length(),
|
||||
"last dimension of indices can be at most the rank of params");
|
||||
|
||||
PartialShape result_shape;
|
||||
if (params_shape.rank().is_static() && indices_shape.rank().is_static())
|
||||
{
|
||||
std::vector<Dimension> result_dims(
|
||||
indices_shape.rank().get_length() - 1 + params_shape.rank().get_length() -
|
||||
indices_shape[indices_shape.rank().get_length() - 1].get_length());
|
||||
size_t i = 0;
|
||||
for (; i < indices_shape.rank().get_length() - 1; i++)
|
||||
{
|
||||
result_dims[i] = indices_shape[i];
|
||||
}
|
||||
for (size_t j = indices_shape[indices_shape.rank().get_length() - 1].get_length();
|
||||
j < params_shape.rank().get_length();
|
||||
i++, j++)
|
||||
{
|
||||
result_dims[i] = params_shape[j];
|
||||
}
|
||||
|
||||
result_shape = PartialShape(result_dims);
|
||||
}
|
||||
else
|
||||
{
|
||||
result_shape = PartialShape::dynamic();
|
||||
}
|
||||
|
||||
set_output_type(0, result_et, result_shape);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,14 +40,15 @@ using namespace ngraph;
|
|||
|
||||
static string s_manifest = "${MANIFEST}";
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_4d_indices_no_axis_uint8)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_4d_indices_axis_0_uint8)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2, 3, 4};
|
||||
Shape out_shape{2, 2, 3, 4, 2};
|
||||
auto P = make_shared<op::Parameter>(element::u8, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -73,14 +74,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_4d_indices_no_axis_uint8)
|
|||
read_vector<uint8_t>(result)));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_4d_indices_no_axis_2d_input)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_4d_indices_axis_0_2d_input)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2, 3, 4};
|
||||
Shape out_shape{2, 2, 3, 4, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -109,14 +111,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_4d_indices_no_axis_2d_input)
|
|||
MIN_FLOAT_TOLERANCE_BITS));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_3d_indices_no_axis_2d_input)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_3d_indices_axis_0_2d_input)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 3, 4};
|
||||
Shape out_shape{2, 3, 4, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -140,14 +143,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_3d_indices_no_axis_2d_input)
|
|||
MIN_FLOAT_TOLERANCE_BITS));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_2d_indices_no_axis_2d_input)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_2d_indices_axis_0_2d_input)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -166,14 +170,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_2d_indices_no_axis_2d_input)
|
|||
MIN_FLOAT_TOLERANCE_BITS));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_2d_negative_and_positive_indices_no_axis_2d_input)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_2d_negative_and_positive_indices_axis_0_2d_input)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -192,14 +197,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_2d_negative_and_positive_indices_no_axis_2d_
|
|||
MIN_FLOAT_TOLERANCE_BITS));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_1d_indices_no_axis_1d_input)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_1d_indices_axis_0_1d_input)
|
||||
{
|
||||
Shape params_shape{3};
|
||||
Shape indices_shape{2};
|
||||
Shape out_shape{2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -217,14 +223,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_1d_indices_no_axis_1d_input)
|
|||
(vector<float>{2.0f, 1.0f}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_no_axis_2d_input)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_axis_0_2d_input)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{};
|
||||
Shape out_shape{2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -249,7 +256,8 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_2d_indices_axis_1_2d_input)
|
|||
Shape out_shape{3, 1, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I, 1);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {1});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -275,7 +283,8 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_1d_indices_axis_2_4d_input)
|
|||
Shape out_shape{2, 2, 2, 3};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I, 2);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {2});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -306,7 +315,8 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_axis_1_2d_input)
|
|||
Shape out_shape{3};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I, 1);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {1});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -324,14 +334,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_scalar_indices_axis_1_2d_input)
|
|||
(vector<float>{1.0f, 2.0f, 3.0f}), read_vector<float>(result), MIN_FLOAT_TOLERANCE_BITS));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_int8)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_axis_0_int8)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::i8, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -349,14 +360,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_int8)
|
|||
read_vector<int8_t>(result)));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_int16)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_axis_0_int16)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::i16, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i64, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -374,14 +386,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_int16)
|
|||
read_vector<int16_t>(result)));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_int32)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_axis_0_int32)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::i32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -399,14 +412,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_int32)
|
|||
read_vector<int32_t>(result)));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_int64)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_axis_0_int64)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::i64, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i64, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -424,14 +438,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_int64)
|
|||
read_vector<int64_t>(result)));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_uint8)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_axis_0_uint8)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::u8, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -449,14 +464,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_uint8)
|
|||
read_vector<uint8_t>(result)));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_uint16)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_axis_0_uint16)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::u16, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i64, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -474,14 +490,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_uint16)
|
|||
read_vector<uint16_t>(result)));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_uint32)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_axis_0_uint32)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::u32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -499,14 +516,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_uint32)
|
|||
read_vector<uint32_t>(result)));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_uint64)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_axis_0_uint64)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::u64, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i64, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -524,14 +542,15 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_uint64)
|
|||
read_vector<uint64_t>(result)));
|
||||
}
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_no_axis_bool)
|
||||
NGRAPH_TEST(${BACKEND_NAME}, gather_axis_0_bool)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::boolean, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i64, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_single_indices)
|
|||
Shape out_shape{};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -79,7 +79,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_2d)
|
|||
Shape out_shape{2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -111,7 +111,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_1d_from_2d)
|
|||
Shape out_shape{2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -145,7 +145,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_scalar_from_3d)
|
|||
Shape out_shape{2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -177,7 +177,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_1d_from_3d)
|
|||
Shape out_shape{2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -211,7 +211,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_2d_from_3d)
|
|||
Shape out_shape{1, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -245,7 +245,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_scalar_from_2d)
|
|||
Shape out_shape{2, 1};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -277,7 +277,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_1d_from_2d)
|
|||
Shape out_shape{2, 1, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -311,7 +311,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_scalar_from_3d)
|
|||
Shape out_shape{2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -345,7 +345,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_1d_from_3d)
|
|||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
@ -379,7 +379,7 @@ NGRAPH_TEST(${BACKEND_NAME}, gather_nd_batch_2d_from_3d)
|
|||
Shape out_shape{2, 1, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::GatherND>(P, I);
|
||||
auto G = make_shared<op::v5::GatherND>(P, I);
|
||||
auto f = make_shared<Function>(G, ParameterVector{P, I});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
|
|
|||
|
|
@ -1829,37 +1829,6 @@ TEST(constant_folding, const_floor)
|
|||
ASSERT_TRUE(test::all_close_f(values_out, values_expected, MIN_FLOAT_TOLERANCE_BITS));
|
||||
}
|
||||
|
||||
TEST(constant_folding, const_gather)
|
||||
{
|
||||
auto constant_data = op::Constant::create(
|
||||
element::f32,
|
||||
Shape{2, 5},
|
||||
vector<float>{1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f});
|
||||
auto constant_indices =
|
||||
op::Constant::create(element::i64, Shape{4}, vector<int64_t>{0, 3, 2, 2});
|
||||
size_t gather_axis = 1;
|
||||
auto gather = make_shared<op::v0::Gather>(constant_data, constant_indices, gather_axis);
|
||||
gather->set_friendly_name("test");
|
||||
auto f = make_shared<Function>(gather, ParameterVector{});
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<pass::ConstantFolding>();
|
||||
pass_manager.run_passes(f);
|
||||
|
||||
ASSERT_EQ(count_ops_of_type<op::v0::Gather>(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<float>();
|
||||
|
||||
vector<float> values_expected{1.0f, 4.0f, 3.0f, 3.0f, 6.0f, 9.0f, 8.0f, 8.0f};
|
||||
|
||||
ASSERT_TRUE(test::all_close_f(values_out, values_expected, MIN_FLOAT_TOLERANCE_BITS));
|
||||
}
|
||||
|
||||
TEST(constant_folding, const_gather_v1)
|
||||
{
|
||||
auto constant_data = op::Constant::create(
|
||||
|
|
|
|||
|
|
@ -1207,12 +1207,14 @@ TEST(eval, evaluate_dynamic_gather)
|
|||
{
|
||||
auto arg1 = make_shared<op::Parameter>(element::f32, PartialShape::dynamic());
|
||||
auto arg2 = make_shared<op::Parameter>(element::i32, PartialShape::dynamic());
|
||||
auto gather = make_shared<op::v0::Gather>(arg1, arg2);
|
||||
auto fun = make_shared<Function>(OutputVector{gather}, ParameterVector{arg1, arg2});
|
||||
auto arg3 = make_shared<op::Parameter>(element::i32, PartialShape::dynamic());
|
||||
auto gather = make_shared<op::v1::Gather>(arg1, arg2, arg3);
|
||||
auto fun = make_shared<Function>(OutputVector{gather}, ParameterVector{arg1, arg2, arg3});
|
||||
auto result_tensor = make_shared<HostTensor>();
|
||||
ASSERT_TRUE(fun->evaluate({result_tensor},
|
||||
{make_host_tensor<element::Type_t::f32>({3}, {1.0f, 2.0f, 3.0f}),
|
||||
make_host_tensor<element::Type_t::i32>({2}, {1, 0})}));
|
||||
make_host_tensor<element::Type_t::i32>({2}, {1, 0}),
|
||||
make_host_tensor<element::Type_t::i32>({1}, {0})}));
|
||||
EXPECT_EQ(result_tensor->get_element_type(), element::f32);
|
||||
EXPECT_EQ(result_tensor->get_partial_shape(), (PartialShape{2}));
|
||||
auto cval = read_vector<float>(result_tensor);
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ namespace
|
|||
|
||||
void op_is_Gather()
|
||||
{
|
||||
op::Gather node;
|
||||
op::v1::Gather 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));
|
||||
|
|
@ -337,7 +337,7 @@ namespace
|
|||
|
||||
void op_is_GatherND()
|
||||
{
|
||||
op::GatherND node;
|
||||
op::v5::GatherND 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));
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ max_to_scalar_int8
|
|||
onnx_dyn_shapes_model_tile_static
|
||||
|
||||
# Segfault
|
||||
gather_4d_indices_no_axis_uint8
|
||||
gather_4d_indices_axis_0_uint8
|
||||
tensor_constant_with_op
|
||||
constant_equality_bool
|
||||
reduce_product_matrix_rows
|
||||
|
|
@ -577,10 +577,10 @@ group_conv_data_dilation
|
|||
# [NOT_IMPLEMENTED] Input image format I64 is not supported yet...
|
||||
slice_3d_strided_different_strides_int64
|
||||
maximum_int64
|
||||
gather_no_axis_int16
|
||||
gather_no_axis_int64
|
||||
gather_no_axis_uint16
|
||||
gather_no_axis_uint64
|
||||
gather_axis_0_int16
|
||||
gather_axis_0_int64
|
||||
gather_axis_0_uint16
|
||||
gather_axis_0_uint64
|
||||
concat_matrix_int64
|
||||
greater_int64
|
||||
broadcast_vector_rowwise_int64
|
||||
|
|
@ -599,7 +599,7 @@ not
|
|||
logical_xor
|
||||
logical_or
|
||||
logical_and
|
||||
gather_no_axis_bool
|
||||
gather_axis_0_bool
|
||||
lesseq_bool
|
||||
auto_bcast_binary_elementwise
|
||||
auto_bcast_binary_elementwise_pdpd
|
||||
|
|
@ -921,10 +921,10 @@ broadcast_algo_matrix_stride_2
|
|||
broadcast_algo_matrix_stride_3
|
||||
|
||||
# Failing from new reason after unblocking more Blob types
|
||||
gather_2d_negative_and_positive_indices_no_axis_2d_input
|
||||
gather_no_axis_int8
|
||||
gather_no_axis_uint8
|
||||
gather_no_axis_uint32
|
||||
gather_2d_negative_and_positive_indices_axis_0_2d_input
|
||||
gather_axis_0_int8
|
||||
gather_axis_0_uint8
|
||||
gather_axis_0_uint32
|
||||
split_3_equal_parts
|
||||
split_var_len_parts
|
||||
floor_int32
|
||||
|
|
@ -1346,7 +1346,7 @@ IE_GPU.gather_2d_indices_no_axis_2d_input
|
|||
IE_GPU.gather_1d_indices_no_axis_1d_input
|
||||
IE_GPU.gather_2d_indices_axis_1_2d_input
|
||||
IE_GPU.gather_1d_indices_axis_2_4d_input
|
||||
IE_GPU.gather_no_axis_int32
|
||||
IE_GPU.gather_axis_0_int32
|
||||
IE_GPU.hardsigmoid
|
||||
IE_GPU.space_to_depth_block_first
|
||||
IE_GPU.space_to_depth_depth_first
|
||||
|
|
|
|||
|
|
@ -656,32 +656,6 @@ protected:
|
|||
args[0]->get_data_ptr<const T>(), out[0]->get_data_ptr<T>(), element_count);
|
||||
break;
|
||||
}
|
||||
case OP_TYPEID::GatherND:
|
||||
{
|
||||
if (node.get_input_element_type(1) == element::i64)
|
||||
{
|
||||
reference::gather_nd<T, int64_t>(args[0]->get_data_ptr<T>(),
|
||||
args[1]->get_data_ptr<int64_t>(),
|
||||
out[0]->get_data_ptr<T>(),
|
||||
node.get_input_shape(0),
|
||||
node.get_input_shape(1),
|
||||
node.get_output_shape(0));
|
||||
}
|
||||
else if (node.get_input_element_type(1) == element::i32)
|
||||
{
|
||||
reference::gather_nd<T, int32_t>(args[0]->get_data_ptr<T>(),
|
||||
args[1]->get_data_ptr<int32_t>(),
|
||||
out[0]->get_data_ptr<T>(),
|
||||
node.get_input_shape(0),
|
||||
node.get_input_shape(1),
|
||||
node.get_output_shape(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ngraph_error("Unexpected type");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OP_TYPEID::GatherND_v5:
|
||||
{
|
||||
const op::v5::GatherND* gatherNDNode = static_cast<const op::v5::GatherND*>(&node);
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ INTERPRETER.max_3d_to_scalar_double
|
|||
INTERPRETER.gelu_f64
|
||||
INTERPRETER.gelu_backprop_factor_f64
|
||||
INTERPRETER.backwards_gelu_f64
|
||||
INTERPRETER.gather_4d_indices_no_axis_uint8
|
||||
INTERPRETER.gather_no_axis_int8
|
||||
INTERPRETER.gather_no_axis_int16
|
||||
INTERPRETER.gather_no_axis_uint8
|
||||
INTERPRETER.gather_no_axis_uint16
|
||||
INTERPRETER.gather_4d_indices_axis_0_uint8
|
||||
INTERPRETER.gather_axis_0_int8
|
||||
INTERPRETER.gather_axis_0_int16
|
||||
INTERPRETER.gather_axis_0_uint8
|
||||
INTERPRETER.gather_axis_0_uint16
|
||||
INTERPRETER.fused_clamp_double
|
||||
INTERPRETER.fused_clamp_int8
|
||||
INTERPRETER.fused_clamp_int16
|
||||
|
|
|
|||
|
|
@ -78,8 +78,7 @@ NGRAPH_OP(Exp, ngraph::op)
|
|||
NGRAPH_OP(FakeQuantize, ngraph::op)
|
||||
NGRAPH_OP(Floor, ngraph::op)
|
||||
NGRAPH_OP(GRN, ngraph::op)
|
||||
NGRAPH_OP(Gather, ngraph::op)
|
||||
NGRAPH_OP(GatherND, ngraph::op)
|
||||
NGRAPH_OP(Gather, ngraph::op::v1)
|
||||
NGRAPH_OP(Gelu, ngraph::op)
|
||||
NGRAPH_OP(Greater, ngraph::op)
|
||||
NGRAPH_OP(GreaterEq, ngraph::op)
|
||||
|
|
|
|||
|
|
@ -217,27 +217,6 @@ namespace opset0_downgrade
|
|||
return op_cast_binary_elementwise_node<op::v0::Equal, op::v1::Equal>(node);
|
||||
}
|
||||
|
||||
shared_ptr<Node> op_cast(shared_ptr<op::v1::Gather> node)
|
||||
{
|
||||
auto axis_node = as_type_ptr<op::Constant>(node->input_value(2).get_node_shared_ptr());
|
||||
|
||||
NGRAPH_CHECK(axis_node,
|
||||
"Unable to convert Gather:v1 to Gather:v0 if axis is not constant. Node: ",
|
||||
*node);
|
||||
|
||||
NGRAPH_CHECK(
|
||||
axis_node->get_element_type() == element::i64,
|
||||
"Unable to convert Gather:v1 to Gather:v0 with axis other type than int64. Node: ",
|
||||
*node);
|
||||
|
||||
int64_t axis = axis_node->get_vector<int64_t>()[0];
|
||||
|
||||
auto replacement_node =
|
||||
make_shared<op::v0::Gather>(node->input_value(0), node->input_value(1), axis);
|
||||
replace_node(node, replacement_node);
|
||||
return replacement_node;
|
||||
}
|
||||
|
||||
shared_ptr<Node> op_cast(shared_ptr<op::v1::Greater> node)
|
||||
{
|
||||
return op_cast_binary_elementwise_node<op::v0::Greater, op::v1::Greater>(node);
|
||||
|
|
|
|||
|
|
@ -140,17 +140,6 @@ namespace opset1_upgrade
|
|||
return op_cast_binary_elementwise_node<op::v0::Equal, op::v1::Equal>(node);
|
||||
}
|
||||
|
||||
shared_ptr<Node> op_cast(shared_ptr<op::Gather> node)
|
||||
{
|
||||
int64_t axis = node->get_axis();
|
||||
|
||||
auto axis_node = make_shared<op::Constant>(element::i64, Shape{}, vector<int64_t>{axis});
|
||||
auto replacement_node =
|
||||
make_shared<op::v1::Gather>(node->input_value(0), node->input_value(1), axis_node);
|
||||
replace_node(node, replacement_node);
|
||||
return replacement_node;
|
||||
}
|
||||
|
||||
shared_ptr<Node> op_cast(shared_ptr<op::Greater> node)
|
||||
{
|
||||
return op_cast_binary_elementwise_node<op::v0::Greater, op::v1::Greater>(node);
|
||||
|
|
|
|||
|
|
@ -23,75 +23,32 @@ NGRAPH_SUPPRESS_DEPRECATED_START
|
|||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
TEST(type_prop, gather_no_axis)
|
||||
TEST(type_prop, gather_axis_0)
|
||||
{
|
||||
Shape params_shape{3, 2};
|
||||
Shape indices_shape{2, 2};
|
||||
Shape out_shape{2, 2, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {0});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
ASSERT_EQ(G->get_axis(), 0);
|
||||
}
|
||||
|
||||
TEST(type_prop, gather)
|
||||
TEST(type_prop, gather_axis_1)
|
||||
{
|
||||
Shape params_shape{3, 3};
|
||||
Shape indices_shape{1, 2};
|
||||
Shape out_shape{3, 1, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
auto G = make_shared<op::Gather>(P, I, 1);
|
||||
auto A = op::Constant::create(element::i64, Shape{}, {1});
|
||||
auto G = make_shared<op::v1::Gather>(P, I, A);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
}
|
||||
|
||||
TEST(type_prop, gather_fail_params_rank)
|
||||
{
|
||||
Shape params_shape{3, 3};
|
||||
Shape indices_shape{1, 2};
|
||||
Shape out_shape{3, 1, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
try
|
||||
{
|
||||
auto G = make_shared<op::Gather>(P, I, 2);
|
||||
// Should have thrown, so fail if it didn't
|
||||
FAIL() << "Incorrect params rank";
|
||||
}
|
||||
catch (const NodeValidationFailure& error)
|
||||
{
|
||||
EXPECT_HAS_SUBSTRING(error.what(),
|
||||
std::string("params rank is expected to be at least axis + 1"));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
FAIL() << "Deduced type check failed for unexpected reason";
|
||||
}
|
||||
}
|
||||
|
||||
TEST(type_prop, gather_fail_indices_element_type)
|
||||
{
|
||||
Shape params_shape{3, 3};
|
||||
Shape indices_shape{1, 2};
|
||||
Shape out_shape{3, 1, 2};
|
||||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i16, indices_shape);
|
||||
try
|
||||
{
|
||||
auto G = make_shared<op::Gather>(P, I, 1);
|
||||
// Should have thrown, so fail if it didn't
|
||||
FAIL() << "Incorrect indices element type";
|
||||
}
|
||||
catch (const NodeValidationFailure& error)
|
||||
{
|
||||
EXPECT_HAS_SUBSTRING(error.what(), std::string("Indices element type must be i64 or i32"));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
FAIL() << "Deduced type check failed for unexpected reason";
|
||||
}
|
||||
ASSERT_EQ(G->get_axis(), 1);
|
||||
}
|
||||
|
||||
TEST(type_prop, gather_v1_incorrect_axis_shape)
|
||||
|
|
|
|||
|
|
@ -180,12 +180,6 @@ TEST(type_prop, gather_nd_scalar_from_2d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -199,12 +193,6 @@ TEST(type_prop, gather_nd_1d_from_2d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -218,12 +206,6 @@ TEST(type_prop, gather_nd_scalar_from_3d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -237,12 +219,6 @@ TEST(type_prop, gather_nd_1d_from_3d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -256,12 +232,6 @@ TEST(type_prop, gather_nd_2d_from_3d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -275,12 +245,6 @@ TEST(type_prop, gather_nd_batch_scalar_from_2d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -294,12 +258,6 @@ TEST(type_prop, gather_nd_batch_1d_from_2d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -313,12 +271,6 @@ TEST(type_prop, gather_nd_batch_scalar_from_3d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -332,12 +284,6 @@ TEST(type_prop, gather_nd_batch_1d_from_3d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -351,12 +297,6 @@ TEST(type_prop, gather_nd_batch_2d_from_3d)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
ASSERT_EQ(G->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G->get_shape(), out_shape);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
ASSERT_EQ(G5->get_element_type(), element::f32);
|
||||
ASSERT_EQ(G5->get_shape(), out_shape);
|
||||
|
|
@ -370,23 +310,6 @@ TEST(type_prop, gather_nd_fail_params_rank)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
try
|
||||
{
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
// Should have thrown, so fail if it didn't
|
||||
FAIL() << "Incorrect params rank";
|
||||
}
|
||||
catch (const NodeValidationFailure& error)
|
||||
{
|
||||
EXPECT_HAS_SUBSTRING(error.what(), std::string("params rank is expected to be at least 1"));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
FAIL() << "Deduced type check failed for unexpected reason";
|
||||
}
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
try
|
||||
{
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
|
|
@ -411,24 +334,6 @@ TEST(type_prop, gather_nd_fail_indices_rank)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::i32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
try
|
||||
{
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
// Should have thrown, so fail if it didn't
|
||||
FAIL() << "Incorrect indices rank";
|
||||
}
|
||||
catch (const NodeValidationFailure& error)
|
||||
{
|
||||
EXPECT_HAS_SUBSTRING(error.what(),
|
||||
std::string("indices rank is expected to be at least 1"));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
FAIL() << "Deduced type check failed for unexpected reason";
|
||||
}
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
try
|
||||
{
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
|
|
@ -453,23 +358,6 @@ TEST(type_prop, gather_nd_fail_indices_element_type)
|
|||
auto P = make_shared<op::Parameter>(element::f32, params_shape);
|
||||
auto I = make_shared<op::Parameter>(element::f32, indices_shape);
|
||||
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
try
|
||||
{
|
||||
auto G = make_shared<op::v0::GatherND>(P, I);
|
||||
// Should have thrown, so fail if it didn't
|
||||
FAIL() << "Incorrect indices element type";
|
||||
}
|
||||
catch (const NodeValidationFailure& error)
|
||||
{
|
||||
EXPECT_HAS_SUBSTRING(error.what(), std::string("Indices element type must be i64 or i32"));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
FAIL() << "Deduced type check failed for unexpected reason";
|
||||
}
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
|
||||
try
|
||||
{
|
||||
auto G5 = make_shared<op::v5::GatherND>(P, I);
|
||||
|
|
|
|||
Loading…
Reference in New Issue