Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2019 Arm Limited. |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 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 | */ |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 24 | #ifndef ARM_COMPUTE_GRAPH_ISTREAM_OPERATORS_H |
| 25 | #define ARM_COMPUTE_GRAPH_ISTREAM_OPERATORS_H |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 26 | |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 27 | #include "arm_compute/graph/frontend/IStream.h" |
| 28 | #include "arm_compute/graph/frontend/Types.h" |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 29 | |
| 30 | namespace arm_compute |
| 31 | { |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 32 | namespace graph |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 33 | { |
| 34 | namespace frontend |
| 35 | { |
| 36 | // Forward declarations |
| 37 | class 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 | */ |
| 46 | inline IStream &operator<<(IStream &s, ILayer &&layer) |
| 47 | { |
| 48 | s.add_layer(layer); |
| 49 | return s; |
| 50 | } |
Georgios Pinitas | 5c2fb3f | 2018-05-01 15:26:20 +0100 | [diff] [blame] | 51 | /** 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 | */ |
| 58 | inline IStream &operator<<(IStream &s, ILayer &layer) |
| 59 | { |
| 60 | s.add_layer(layer); |
| 61 | return s; |
| 62 | } |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 63 | /** 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 | */ |
| 70 | inline 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 | */ |
| 82 | inline 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 | */ |
| 94 | inline 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 Arena | 59631a1 | 2018-05-02 13:59:04 +0100 | [diff] [blame] | 99 | /** 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 | */ |
| 106 | inline IStream &operator<<(IStream &s, FastMathHint fast_math_hint) |
| 107 | { |
| 108 | s.hints().fast_math_hint = fast_math_hint; |
| 109 | return s; |
| 110 | } |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 111 | } // namespace frontend |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 112 | } // namespace graph |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 113 | } // namespace arm_compute |
Michalis Spyrou | f464337 | 2019-11-29 16:17:13 +0000 | [diff] [blame] | 114 | #endif /* ARM_COMPUTE_GRAPH_ISTREAM_OPERATORS_H */ |