blob: 63f266b21731c046142b0c71ea86cd8d31f2561a [file] [log] [blame]
Michele Di Giorgioc30b6682018-09-12 17:44:08 +01001/*
Georgios Pinitas0b1c2db2020-12-04 15:51:34 +00002 * Copyright (c) 2018-2020 Arm Limited.
Michele Di Giorgioc30b6682018-09-12 17:44:08 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Michalis Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_GRAPH_SLICE_LAYER_NODE_H
25#define ARM_COMPUTE_GRAPH_SLICE_LAYER_NODE_H
Michele Di Giorgioc30b6682018-09-12 17:44:08 +010026
27#include "arm_compute/graph/INode.h"
28
29#include <tuple>
30
31namespace arm_compute
32{
33namespace graph
34{
35/** Slice Layer node */
36class SliceLayerNode final : public INode
37{
38public:
39 /** Default Constructor
40 *
41 * @param[in] starts The starts of the dimensions of the input tensor to be sliced. The length must be of rank(input).
42 * @param[in] ends The ends of the dimensions of the input tensor to be sliced. The length must be of rank(input).
43 */
Georgios Pinitas0b1c2db2020-12-04 15:51:34 +000044 SliceLayerNode(const Coordinates &starts, const Coordinates &ends);
Michele Di Giorgioc30b6682018-09-12 17:44:08 +010045 /** Computes slice layer output descriptor
46 *
47 * @param[in] input_descriptor Descriptor of the input tensor
48 * @param[in] starts The starts of the dimensions of the input tensor to be sliced. The length must be of rank(input).
49 * @param[in] ends The ends of the dimensions of the input tensor to be sliced. The length must be of rank(input).
50 *
51 * @return Output descriptor
52 */
53 static TensorDescriptor compute_output_descriptor(const TensorDescriptor &input_descriptor,
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010054 const Coordinates &starts,
55 const Coordinates &ends);
Michele Di Giorgioc30b6682018-09-12 17:44:08 +010056 /** Start coordinates accessor
57 *
58 * @return Start coordinates of the dimensions
59 */
60 Coordinates starts() const;
61 /** End coordinates accessor
62 *
63 * @return End coordinates of the dimensions
64 */
65 Coordinates ends() const;
66
67 // Inherited overridden methods:
68 NodeType type() const override;
69 bool forward_descriptors() override;
70 TensorDescriptor configure_output(size_t idx) const override;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010071 void accept(INodeVisitor &v) override;
Michele Di Giorgioc30b6682018-09-12 17:44:08 +010072
73private:
74 Coordinates _starts;
75 Coordinates _ends;
76};
77} // namespace graph
78} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +000079#endif /* ARM_COMPUTE_GRAPH_SLICE_LAYER_NODE_H */