blob: deaf66daefd247f9271999114371183156203fd6 [file] [log] [blame]
Georgios Pinitasd8734b52017-12-22 15:27:52 +00001/*
Michele Di Giorgiod9eaf612020-07-08 11:12:57 +01002 * Copyright (c) 2018-2019 Arm Limited.
Georgios Pinitasd8734b52017-12-22 15:27:52 +00003 *
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_ISTREAM_OPERATORS_H
25#define ARM_COMPUTE_GRAPH_ISTREAM_OPERATORS_H
Georgios Pinitasd8734b52017-12-22 15:27:52 +000026
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010027#include "arm_compute/graph/frontend/IStream.h"
28#include "arm_compute/graph/frontend/Types.h"
Georgios Pinitasd8734b52017-12-22 15:27:52 +000029
30namespace arm_compute
31{
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010032namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +000033{
34namespace frontend
35{
36// Forward declarations
37class ILayer;
38
39/** Overloaded stream operator to add a node to the graph
40 *
41 * @param[in, out] s Stream to add the tensor
42 * @param[in] layer Layer to be added
43 *
44 * @return Updated stream
45 */
46inline IStream &operator<<(IStream &s, ILayer &&layer)
47{
48 s.add_layer(layer);
49 return s;
50}
Georgios Pinitas5c2fb3f2018-05-01 15:26:20 +010051/** Overloaded stream operator to add a node to the graph
52 *
53 * @param[in, out] s Stream to add the tensor
54 * @param[in] layer Layer to be added
55 *
56 * @return Updated stream
57 */
58inline IStream &operator<<(IStream &s, ILayer &layer)
59{
60 s.add_layer(layer);
61 return s;
62}
Georgios Pinitasd8734b52017-12-22 15:27:52 +000063/** Overloaded stream operator to provide a target hint to the graph
64 *
65 * @param[in, out] s Stream to provide the hint to
66 * @param[in] target_hint Target hint to be considered
67 *
68 * @return Updated stream
69 */
70inline IStream &operator<<(IStream &s, Target target_hint)
71{
72 s.hints().target_hint = target_hint;
73 return s;
74}
75/** Overloaded stream operator to provide a convolution method hint to the graph
76 *
77 * @param[in, out] s Stream to provide the hint to
78 * @param[in] convolution_method_hint Convolution method hint to be considered
79 *
80 * @return Updated stream
81 */
82inline IStream &operator<<(IStream &s, ConvolutionMethod convolution_method_hint)
83{
84 s.hints().convolution_method_hint = convolution_method_hint;
85 return s;
86}
87/** Overloaded stream operator to provide a depthwise convolution method hint to the graph
88 *
89 * @param[in, out] s Stream to provide the hint to
90 * @param[in] depthwise_convolution_method_hint Depthwise Convolution method hint to be considered
91 *
92 * @return Updated stream
93 */
94inline IStream &operator<<(IStream &s, DepthwiseConvolutionMethod depthwise_convolution_method_hint)
95{
96 s.hints().depthwise_convolution_method_hint = depthwise_convolution_method_hint;
97 return s;
98}
Giorgio Arena59631a12018-05-02 13:59:04 +010099/** Overloaded stream operator to provide a fast math hint to the graph
100 *
101 * @param[in, out] s Stream to provide the hint to
102 * @param[in] fast_math_hint Convolution method hint to be considered
103 *
104 * @return Updated stream
105 */
106inline IStream &operator<<(IStream &s, FastMathHint fast_math_hint)
107{
108 s.hints().fast_math_hint = fast_math_hint;
109 return s;
110}
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000111} // namespace frontend
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100112} // namespace graph
Georgios Pinitasd8734b52017-12-22 15:27:52 +0000113} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +0000114#endif /* ARM_COMPUTE_GRAPH_ISTREAM_OPERATORS_H */