• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_SELECTORS_SIMPLE_SELECTORS_H_
17 #define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_SELECTORS_SIMPLE_SELECTORS_H_
18 
19 #include <memory>
20 
21 #include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
22 #include "tensorflow/lite/delegates/gpu/common/operations.h"
23 #include "tensorflow/lite/delegates/gpu/common/shape.h"
24 #include "tensorflow/lite/delegates/gpu/common/status.h"
25 #include "tensorflow/lite/delegates/gpu/common/task/gpu_operation.h"
26 
27 namespace tflite {
28 namespace gpu {
29 
30 std::unique_ptr<GPUOperation> SelectLSTM(const OperationDef& op_def,
31                                          const GpuInfo& gpu_info);
32 
33 std::unique_ptr<GPUOperation> SelectReLU(const ReLUAttributes& attr,
34                                          const OperationDef& op_def);
35 
36 std::unique_ptr<GPUOperation> SelectPReLU(const PReLUAttributes& attr,
37                                           const GpuInfo& gpu_info,
38                                           const OperationDef& op_def);
39 
40 std::unique_ptr<GPUOperation> SelectPooling(const Pooling2DAttributes& attr,
41                                             const OperationDef& op_def);
42 
43 std::unique_ptr<GPUOperation> SelectMaxUnpooling(
44     const MaxUnpooling2DAttributes& attr, const OperationDef& op_def);
45 
46 void SelectAdd(const OperationDef& op_def, const std::vector<int>& channels,
47                int dst_channels, std::unique_ptr<GPUOperation>* ptr);
48 
49 absl::Status SelectGather(const GatherAttributes& attr,
50                           const OperationDef& op_def,
51                           std::unique_ptr<GPUOperation>* ptr);
52 
53 absl::Status SelectResize(const Resize2DAttributes& attr,
54                           const OperationDef& op_def,
55                           std::unique_ptr<GPUOperation>* ptr);
56 
57 std::unique_ptr<GPUOperation> SelectResampler(const OperationDef& op_def);
58 
59 absl::Status SelectConcat(const ConcatAttributes& attr,
60                           const std::vector<int>& channels,
61                           const OperationDef& op_def, const GpuInfo& gpu_info,
62                           std::unique_ptr<GPUOperation>* ptr);
63 
64 std::unique_ptr<GPUOperation> SelectDWConvolutionDynamicWeights(
65     const DepthwiseConvolution2DAttributes& attr, const GpuInfo& gpu_info,
66     const OperationDef& op_def);
67 
68 void SelectReshape(int src_channels, int dst_channels,
69                    const OperationDef& op_def,
70                    std::unique_ptr<GPUOperation>* ptr);
71 
72 void SelectPadding(const PadAttributes& attr, const OperationDef& op_def,
73                    std::unique_ptr<GPUOperation>* ptr);
74 
75 void SelectStridedSlice(const SliceAttributes& attr, const OperationDef& op_def,
76                         std::unique_ptr<GPUOperation>* ptr);
77 
78 std::unique_ptr<GPUOperation> SelectReduce(const std::set<Axis>& axis_to_reduce,
79                                            const BHWC& src_shape,
80                                            OperationType op_type,
81                                            const OperationDef& op_def,
82                                            const GpuInfo& gpu_info);
83 
84 void SelectSoftmax(const BHWC& shape, const OperationDef& op_def,
85                    std::unique_ptr<GPUOperation>* ptr);
86 
87 void SelectSpaceToDepth(const SpaceToDepthAttributes& attr,
88                         const OperationDef& op_def,
89                         std::unique_ptr<GPUOperation>* ptr);
90 
91 void SelectDepthToSpace(const SpaceToDepthAttributes& attr,
92                         const OperationDef& op_def,
93                         std::unique_ptr<GPUOperation>* ptr);
94 
95 void SelectSplit(const SplitAttributes& attr, const OperationDef& op_def,
96                  std::unique_ptr<GPUOperation>* ptr);
97 
98 std::unique_ptr<GPUOperation> SelectTile(const OperationDef& op_def,
99                                          const BHWC& src_shape);
100 
101 void SelectTranspose(const TransposeAttributes& attr,
102                      const OperationDef& op_def,
103                      std::unique_ptr<GPUOperation>* ptr);
104 
105 std::unique_ptr<GPUOperation> SelectWinograd4x4To36(const GpuInfo& gpu_info,
106                                                     const Padding2D& padding,
107                                                     const OperationDef& op_def);
108 
109 std::unique_ptr<GPUOperation> SelectWinograd36To4x4(
110     const GpuInfo& gpu_info, const OperationDef& op_def,
111     const tflite::gpu::Tensor<Linear, DataType::FLOAT32>& biases);
112 
113 std::unique_ptr<GPUOperation> SelectQuantizeAndDequantize(
114     const QuantizeAndDequantizeAttributes& attr, const OperationDef& op_def);
115 
116 }  // namespace gpu
117 }  // namespace tflite
118 
119 #endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_SELECTORS_SIMPLE_SELECTORS_H_
120