gather_base.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include "ngraph/op/op.hpp"
8 
9 namespace ngraph
10 {
11  namespace op
12  {
13  namespace util
14  {
15  /// \brief GatherBase basic class for Gather v1 and v7
16  class NGRAPH_API GatherBase : public Op
17  {
18  public:
19  NGRAPH_RTTI_DECLARATION;
20  GatherBase() = default;
21 
22  /// \param data The tensor from which slices are gathered
23  /// \param indices Tensor with indexes to gather
24  /// \param axis The tensor is a dimension index to gather data from
25  /// \param batch_dims The number of batch dimension in data and indices tensors
26  GatherBase(const Output<Node>& data,
27  const Output<Node>& indices,
28  const Output<Node>& axis,
29  const int64_t batch_dims = 0);
30 
31  void validate_and_infer_types() override;
32  virtual int64_t get_axis() const;
33 
34  bool evaluate(const HostTensorVector& outputs,
35  const HostTensorVector& inputs) const override;
36 
37  bool evaluate_lower(const HostTensorVector& outputs) const override;
38  bool evaluate_upper(const HostTensorVector& outputs) const override;
39 
40  bool constant_fold(OutputVector& output_values,
41  const OutputVector& inputs_values) override;
42 
43  protected:
44  int64_t m_batch_dims = 0;
45  };
46  } // namespace util
47  } // namespace op
48 } // namespace ngraph
A handle for one of a node's outputs.
Definition: node_output.hpp:33
Root of all actual ops.
Definition: op.hpp:17
GatherBase basic class for Gather v1 and v7.
Definition: gather_base.hpp:17
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
GatherBase(const Output< Node > &data, const Output< Node > &indices, const Output< Node > &axis, const int64_t batch_dims=0)
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16