reduce_l1.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/util/arithmetic_reductions_keep_dims.hpp"
8 
9 namespace ngraph
10 {
11  namespace op
12  {
13  namespace v4
14  {
15  /// \brief Reduction operation using L1 norm: L1(x) = sum(abs(x)) if all dimensions are
16  /// specified for the normalisation.
17  ///
18  /// Reduces the tensor, eliminating the specified reduction axes by taking the L1-norm.
19  class NGRAPH_API ReduceL1 : public util::ArithmeticReductionKeepDims
20  {
21  public:
22  NGRAPH_RTTI_DECLARATION;
23  /// \brief Constructs a reducet L1-norm operation.
24  ReduceL1() = default;
25  /// \brief Constructs a reduce L1-norm operation.
26  ///
27  /// \param arg The tensor to be reduced.
28  /// \param reduction_axes The axis positions (0-based) to be eliminated.
29  /// \param keep_dims If set to true it holds axes that are used for reduction.
30  ReduceL1(const Output<Node>& arg,
31  const Output<Node>& reduction_axes,
32  bool keep_dims = false);
33 
34  size_t get_version() const override { return 4; }
35  /// \return The default value for Reduce.
36  virtual std::shared_ptr<Node> get_default_value() const override;
37 
38  virtual std::shared_ptr<Node>
39  clone_with_new_inputs(const OutputVector& new_args) const override;
40 
41  bool evaluate(const HostTensorVector& outputs,
42  const HostTensorVector& inputs) const override;
43  bool has_evaluate() const override;
44  };
45  } // namespace v4
46  } // namespace op
47 } // namespace ngraph
A handle for one of a node's outputs.
Definition: node_output.hpp:33
Definition: arithmetic_reductions_keep_dims.hpp:17
Reduction operation using L1 norm: L1(x) = sum(abs(x)) if all dimensions are specified for the normal...
Definition: reduce_l1.hpp:20
ReduceL1()=default
Constructs a reducet L1-norm operation.
virtual std::shared_ptr< Node > get_default_value() const override
bool evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const override
Evaluates the op on input_values putting results in output_values.
size_t get_version() const override
Definition: reduce_l1.hpp:34
bool has_evaluate() const override
Allows to get information about availability of evaluate method for the current operation.
ReduceL1(const Output< Node > &arg, const Output< Node > &reduction_axes, bool keep_dims=false)
Constructs a reduce L1-norm operation.
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:16