• 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_TASKS_RESIZE_H_
17 #define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TASKS_RESIZE_H_
18 
19 #include "tensorflow/lite/delegates/gpu/common/operations.h"
20 #include "tensorflow/lite/delegates/gpu/common/status.h"
21 #include "tensorflow/lite/delegates/gpu/common/task/gpu_operation.h"
22 #include "tensorflow/lite/delegates/gpu/common/types.h"
23 
24 namespace tflite {
25 namespace gpu {
26 
27 class Resize : public GPUOperation {
28  public:
29   absl::Status BindArguments(ArgumentsBinder* args) override;
30   int3 GetGridSize() const override;
31 
32   // Move only
33   Resize(Resize&& operation);
34   Resize& operator=(Resize&& operation);
35   Resize(const Resize&) = delete;
36   Resize& operator=(const Resize&) = delete;
37 
38   friend Resize CreateResize(const OperationDef& definition,
39                              const Resize2DAttributes& attr);
40 
41  private:
42   Resize(const OperationDef& definition, const Resize2DAttributes& attr);
43 
44   std::string GetResizeCode(const OperationDef& op_def,
45                             const Resize2DAttributes& attr);
46 
47   Resize2DAttributes attr_;
48 };
49 
50 Resize CreateResize(const OperationDef& definition,
51                     const Resize2DAttributes& attr);
52 
53 class Resize3D : public GPUOperation {
54  public:
55   absl::Status BindArguments(ArgumentsBinder* args) override;
56   int3 GetGridSize() const override;
57 
58   // Move only
59   Resize3D(Resize3D&& operation);
60   Resize3D& operator=(Resize3D&& operation);
61   Resize3D(const Resize3D&) = delete;
62   Resize3D& operator=(const Resize3D&) = delete;
63 
64   friend Resize3D CreateResize3D(const OperationDef& definition,
65                                  const Resize3DAttributes& attr);
66 
67  private:
68   Resize3D(const OperationDef& definition, const Resize3DAttributes& attr);
69 
70   std::string GetResize3DCode(const OperationDef& op_def,
71                               const Resize3DAttributes& attr);
72 
73   Resize3DAttributes attr_;
74 };
75 
76 Resize3D CreateResize3D(const OperationDef& definition,
77                         const Resize3DAttributes& attr);
78 
79 }  // namespace gpu
80 }  // namespace tflite
81 
82 #endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TASKS_RESIZE_H_
83