Deprecate nGraph v0 ops and builders (#1856)
[platform/upstream/dldt.git] / ngraph / core / include / ngraph / op / slice.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/coordinate.hpp"
20 #include "ngraph/op/op.hpp"
21 #include "ngraph/strides.hpp"
22
23 namespace ngraph
24 {
25     namespace op
26     {
27         namespace v0
28         {
29             /// \brief Takes a slice of an input tensor, i.e., the sub-tensor that resides within a
30             ///        bounding box, optionally with stride.
31             class NGRAPH_DEPRECATED(
32                 "This operation is deprecated and will be removed soon. Please do not use it.")
33                 NGRAPH_API Slice : public Op
34             {
35                 NGRAPH_SUPPRESS_DEPRECATED_START
36             public:
37                 static constexpr NodeTypeInfo type_info{"Slice", 0};
38                 const NodeTypeInfo& get_type_info() const override { return type_info; }
39                 /// \brief Constructs a tensor slice operation
40                 Slice() = default;
41                 /// \brief Constructs a tensor slice operation.
42                 ///
43                 /// \param arg The tensor to be sliced.
44                 /// \param lower_bounds The axiswise lower bounds of the slice (inclusive).
45                 /// \param upper_bounds The axiswise upper bounds of the slice (exclusive).
46                 /// \param strides The slicing strides; for example, strides of `{n,m}` means to
47                 /// take
48                 ///                every nth row and every mth column of the input matrix.
49                 Slice(const Output<Node>& arg,
50                       const Coordinate& lower_bounds,
51                       const Coordinate& upper_bounds,
52                       const Strides& strides);
53                 /// \brief Constructs a tensor slice operation with unit strides; i.e., every
54                 /// element
55                 ///        inside the bounding box will be copied to the output slice.
56                 ///
57                 /// \param arg The tensor to be sliced.
58                 /// \param lower_bounds The axiswise lower bounds of the slice (inclusive).
59                 /// \param upper_bounds The axiswise upper bounds of the slice (exclusive).
60                 Slice(const Output<Node>& arg,
61                       const Coordinate& lower_bounds,
62                       const Coordinate& upper_bounds);
63
64                 virtual std::shared_ptr<Node>
65                     clone_with_new_inputs(const OutputVector& new_args) const override;
66                 void validate_and_infer_types() override;
67
68                 /// \return The inclusive lower-bound coordinates.
69                 const Coordinate& get_lower_bounds() const { return m_lower_bounds; }
70                 /// \return The exclusive upper-bound coordinates.
71                 const Coordinate& get_upper_bounds() const { return m_upper_bounds; }
72                 /// \return The slicing strides.
73                 const Strides& get_strides() const { return m_strides; }
74                 bool evaluate(const HostTensorVector& outputs,
75                               const HostTensorVector& inputs) const override;
76
77             protected:
78                 Coordinate m_lower_bounds;
79                 Coordinate m_upper_bounds;
80                 Strides m_strides;
81                 NGRAPH_SUPPRESS_DEPRECATED_END
82             };
83         }
84         // default opset version
85         NGRAPH_SUPPRESS_DEPRECATED_START
86         using v0::Slice;
87         NGRAPH_SUPPRESS_DEPRECATED_END
88     }
89 }