log_softmax.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 v5
14  {
15  class NGRAPH_API LogSoftmax : public Op
16  {
17  public:
18  NGRAPH_RTTI_DECLARATION;
19  LogSoftmax() = default;
20  /// \brief Constructs a LogSoftmax operation.
21  ///
22  /// \param arg Node that produces the first input tensor.<br>
23  /// `[d0, ...]`
24  /// \param axis The axis position (0-based) on which to calculate the LogSoftmax.
25  ///
26  /// Output `[d0, ...]`
27  ///
28  LogSoftmax(const Output<Node>& arg, const int64_t axis);
29 
30  bool visit_attributes(AttributeVisitor& visitor) override;
31  void validate_and_infer_types() override;
32 
33  size_t get_version() const override { return 1; }
34  virtual std::shared_ptr<Node>
35  clone_with_new_inputs(const OutputVector& new_args) const override;
36 
37  int64_t get_axis() const { return m_axis; }
38  void set_axis(const int64_t axis) { m_axis = axis; }
39 
40  private:
41  int64_t m_axis = 1;
42  };
43  } // namespace v5
44  } // namespace op
45 } // namespace ngraph
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:59
A handle for one of a node's outputs.
Definition: node_output.hpp:33
Root of all actual ops.
Definition: op.hpp:17
Definition: log_softmax.hpp:16
size_t get_version() const override
Definition: log_softmax.hpp:33
LogSoftmax(const Output< Node > &arg, const int64_t axis)
Constructs a LogSoftmax operation.
void validate_and_infer_types() override
Verifies that attributes and inputs are consistent and computes output shapes and element types....
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16