embeddingbag_packedsum.hpp
1 // Copyright (C) 2018-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #pragma once
6 
7 #include "ngraph/axis_set.hpp"
8 #include "ngraph/op/util/embeddingbag_packed_base.hpp"
9 #include "ngraph/op/util/index_reduction.hpp"
10 
11 namespace ngraph
12 {
13  namespace op
14  {
15  namespace v3
16  {
17  /// \brief Returns embeddings for given indices
19  {
20  public:
21  static constexpr NodeTypeInfo type_info{"EmbeddingBagPackedSum", 3};
22  const NodeTypeInfo& get_type_info() const override { return type_info; }
23  /// \brief Constructs a EmbeddingBagPackedSum operation.
24  EmbeddingBagPackedSum() = default;
25  /// \brief Constructs a EmbeddingBagPackedSum operation.
26  ///
27  /// EmbeddingBagPackedSum constructs an output tensor by replacing every index in a
28  /// given
29  /// input tensor with a row (from the weights matrix) at that index
30  ///
31  /// \param emb_table Tensor containing the embedding lookup table of the module of
32  /// shape [num_emb, emb_dim1, emb_dim2, ...] and of type T
33  /// \param indices Tensor of shape `[batch, indices_per_bag]` and of type *T_IND*.
34  /// Required.
35  /// \param per_sample_weigths tensor of the same shape as indices and of type T.
36  /// Each value in this tensor are multiplied with each
37  /// value pooled from embedding table for each index. Optional.
38 
40  const Output<Node>& indices,
41  const Output<Node>& per_sample_weights);
42 
43  EmbeddingBagPackedSum(const Output<Node>& emb_table, const Output<Node>& indices);
44 
45  virtual std::shared_ptr<Node>
46  clone_with_new_inputs(const OutputVector& new_args) const override;
47  };
48  } // namespace v3
50  } // namespace op
51 } // namespace ngraph
A handle for one of a node's outputs.
Definition: node_output.hpp:33
Returns embeddings for given indices.
Definition: embeddingbag_packed_base.hpp:18
Returns embeddings for given indices.
Definition: embeddingbag_packedsum.hpp:19
EmbeddingBagPackedSum()=default
Constructs a EmbeddingBagPackedSum operation.
EmbeddingBagPackedSum(const Output< Node > &emb_table, const Output< Node > &indices, const Output< Node > &per_sample_weights)
Constructs a EmbeddingBagPackedSum operation.
const NodeTypeInfo & get_type_info() const override
Definition: embeddingbag_packedsum.hpp:22
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16
Definition: type.hpp:27