log_softmax.hpp
1 //*****************************************************************************
2 // Copyright 2017-2021 Intel Corporation
3 //
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
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
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 //*****************************************************************************
16 
17 #pragma once
18 
19 #include "ngraph/op/op.hpp"
20 
21 namespace ngraph
22 {
23  namespace op
24  {
25  namespace v5
26  {
27  class NGRAPH_API LogSoftmax : public Op
28  {
29  public:
30  NGRAPH_RTTI_DECLARATION;
31  LogSoftmax() = default;
32  /// \brief Constructs a LogSoftmax operation.
33  ///
34  /// \param arg Node that produces the first input tensor.<br>
35  /// `[d0, ...]`
36  /// \param axis The axis position (0-based) on which to calculate the LogSoftmax.
37  ///
38  /// Output `[d0, ...]`
39  ///
40  LogSoftmax(const Output<Node>& arg, const int64_t axis);
41 
42  bool visit_attributes(AttributeVisitor& visitor) override;
43  void validate_and_infer_types() override;
44 
45  size_t get_version() const override { return 1; }
46  virtual std::shared_ptr<Node>
47  clone_with_new_inputs(const OutputVector& new_args) const override;
48 
49  int64_t get_axis() const { return m_axis; }
50  void set_axis(const int64_t axis) { m_axis = axis; }
51  private:
52  int64_t m_axis = 1;
53  };
54  } // namespace v5
55  } // namespace op
56 } // namespace ngraph
Visits the attributes of a node, primarily for serialization-like tasks.
Definition: attribute_visitor.hpp:71
A handle for one of a node's outputs.
Definition: node_output.hpp:42
Root of all actual ops.
Definition: op.hpp:29
Definition: log_softmax.hpp:28
size_t get_version() const override
Definition: log_softmax.hpp:45
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:28