Compute Library
 23.05
SliceLayerNode.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020 Arm Limited.
3  *
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  */
24 #ifndef ARM_COMPUTE_GRAPH_SLICE_LAYER_NODE_H
25 #define ARM_COMPUTE_GRAPH_SLICE_LAYER_NODE_H
26 
28 
29 #include <tuple>
30 
31 namespace arm_compute
32 {
33 namespace graph
34 {
35 /** Slice Layer node */
36 class SliceLayerNode final : public INode
37 {
38 public:
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  */
45  /** 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,
54  const Coordinates &starts, const Coordinates &ends);
55  /** Start coordinates accessor
56  *
57  * @return Start coordinates of the dimensions
58  */
59  Coordinates starts() const;
60  /** End coordinates accessor
61  *
62  * @return End coordinates of the dimensions
63  */
64  Coordinates ends() const;
65 
66  // Inherited overridden methods:
67  NodeType type() const override;
68  bool forward_descriptors() override;
69  TensorDescriptor configure_output(size_t idx) const override;
70  void accept(INodeVisitor &v) override;
71 
72 private:
73  Coordinates _starts;
74  Coordinates _ends;
75 };
76 } // namespace graph
77 } // namespace arm_compute
78 #endif /* ARM_COMPUTE_GRAPH_SLICE_LAYER_NODE_H */
SliceLayerNode(const Coordinates &starts, const Coordinates &ends)
Default Constructor.
void accept(INodeVisitor &v) override
Accepts a node visitor.
Copyright (c) 2017-2023 Arm Limited.
Node interface.
Definition: INode.h:46
TensorDescriptor configure_output(size_t idx) const override
Calculates output configuration.
Coordinates of an item.
Definition: Coordinates.h:37
Coordinates starts() const
Start coordinates accessor.
Coordinates ends() const
End coordinates accessor.
NodeType
Supported nodes.
Definition: Types.h:199
static TensorDescriptor compute_output_descriptor(const TensorDescriptor &input_descriptor, const Coordinates &starts, const Coordinates &ends)
Computes slice layer output descriptor.
bool forward_descriptors() override
Forwards descriptor information to outputs if possible.
NodeType type() const override
Returns node&#39;s type.
Node visitor interface.
Definition: INodeVisitor.h:34