reduce_prod.hpp
1 //*****************************************************************************
2 // Copyright 2017-2020 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/util/arithmetic_reductions_keep_dims.hpp"
20 
21 namespace ngraph
22 {
23  namespace op
24  {
25  namespace v1
26  {
27  /// \brief Product reduction operation.
28  ///
29  /// Reduces the tensor, eliminating the specified reduction axes by taking the product.
31  {
32  public:
33  static constexpr NodeTypeInfo type_info{"ReduceProd", 1};
34  const NodeTypeInfo& get_type_info() const override { return type_info; }
35  /// \brief Constructs a product reduction operation.
36  ReduceProd() = default;
37  /// \brief Constructs a product reduction operation.
38  ///
39  /// \param arg The tensor to be reduced.
40  /// \param reduction_axes The axis positions (0-based) to be eliminated.
41  /// \param keep_dims If set to true it holds axes that are used for reduction.
42  ReduceProd(const Output<Node>& arg,
43  const Output<Node>& reduction_axes,
44  bool keep_dims = false);
45 
46  size_t get_version() const override { return 1; }
47  /// \return The default value for Product.
48  virtual std::shared_ptr<Node> get_default_value() const override;
49 
50  virtual std::shared_ptr<Node>
51  clone_with_new_inputs(const OutputVector& new_args) const override;
52 
53  bool evaluate(const HostTensorVector& outputs,
54  const HostTensorVector& inputs) const override;
55  };
56  }
57  }
58 }
ngraph::op::v1::ReduceProd
Product reduction operation.
Definition: reduce_prod.hpp:31
ngraph::op::util::ArithmeticReductionKeepDims
Definition: arithmetic_reductions_keep_dims.hpp:29
ngraph::op::v1::ReduceProd::get_default_value
virtual std::shared_ptr< Node > get_default_value() const override
ngraph::op::v1::ReduceProd::get_type_info
const NodeTypeInfo & get_type_info() const override
Definition: reduce_prod.hpp:34
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::op::v1::ReduceProd::ReduceProd
ReduceProd()=default
Constructs a product reduction operation.
ngraph::op::v1::ReduceProd::get_version
size_t get_version() const override
Definition: reduce_prod.hpp:46
ngraph::op::v1::ReduceProd::ReduceProd
ReduceProd(const Output< Node > &arg, const Output< Node > &reduction_axes, bool keep_dims=false)
Constructs a product reduction operation.