1 //*****************************************************************************
2 // Copyright 2017-2020 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //*****************************************************************************
19 #include "ngraph/op/op.hpp"
27 /// \brief Gather slices from axis of params according to indices
28 class NGRAPH_DEPRECATED(
29 "This operation is deprecated and will be removed soon. "
30 "Use v1::Gather instead of it.") NGRAPH_API Gather : public Op
32 NGRAPH_SUPPRESS_DEPRECATED_START
34 static constexpr NodeTypeInfo type_info{"Gather", 0};
35 const NodeTypeInfo& get_type_info() const override { return type_info; }
37 /// \param params The tensor from which slices are gathered
38 /// \param indices Index tensor: Data type must be `element::i32` or `element::i64`
39 /// \param axis Axis in params to gather
40 Gather(const Output<Node>& params, const Output<Node>& indices, size_t axis = 0);
42 void validate_and_infer_types() override;
44 size_t get_axis() const { return m_axis; }
45 void set_axis(size_t axis) { m_axis = axis; }
46 virtual std::shared_ptr<Node>
47 clone_with_new_inputs(const OutputVector& new_args) const override;
48 bool evaluate(const HostTensorVector& outputs,
49 const HostTensorVector& inputs) const override;
53 NGRAPH_SUPPRESS_DEPRECATED_END
59 /// \brief Gather slices from axis of params according to indices
60 class NGRAPH_API Gather : public Op
63 static const int64_t AXIS_NOT_SET_VALUE = std::numeric_limits<int64_t>::max();
64 static constexpr NodeTypeInfo type_info{"Gather", 1};
65 const NodeTypeInfo& get_type_info() const override { return type_info; }
67 /// \param params The tensor from which slices are gathered
68 /// \param indices Tensor with indexes to gather
69 /// \param axis The tensor is a dimension index to gather data from
70 Gather(const Output<Node>& params,
71 const Output<Node>& indices,
72 const Output<Node>& axis);
74 bool visit_attributes(AttributeVisitor& visitor) override;
75 int64_t get_axis() const;
77 void validate_and_infer_types() override;
79 virtual std::shared_ptr<Node>
80 clone_with_new_inputs(const OutputVector& new_args) const override;
82 bool evaluate(const HostTensorVector& outputs,
83 const HostTensorVector& inputs) const override;
87 // latest stable opset version
88 NGRAPH_SUPPRESS_DEPRECATED_START
90 NGRAPH_SUPPRESS_DEPRECATED_END