2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #include "OperationUtils.h"
17 #include "ResizeBilinearLayer.h"
18 #include "cker/operation/ResizeBilinear.h"
19 #include <cker/Types.h>
30 ResizeBilinearLayer::ResizeBilinearLayer()
31 : _input(nullptr), _output(nullptr), _output_height(0), _output_width(0), _align_corners(false),
32 _half_pixel_centers(false)
37 void ResizeBilinearLayer::configure(const IPortableTensor *input, IPortableTensor *output,
38 int32_t output_height, int32_t output_width, bool align_corners,
39 bool half_pixel_centers)
43 _output_height = output_height;
44 _output_width = output_width;
45 _align_corners = align_corners;
46 _half_pixel_centers = half_pixel_centers;
49 void ResizeBilinearLayer::run()
51 nnfw::cker::ResizeBilinearParams params;
52 params.align_corners = _align_corners;
53 params.half_pixel_centers = _half_pixel_centers;
54 params.output_height = _output_height;
55 params.output_width = _output_width;
57 switch (_input->data_type())
59 case OperandType::FLOAT32:
60 nnfw::cker::ResizeBilinear(
61 params, getTensorShape(_input), reinterpret_cast<const float *>(_input->buffer()),
62 getTensorShape(_output), reinterpret_cast<float *>(_output->buffer()));
65 case OperandType::QUANT_UINT8_ASYMM:
66 nnfw::cker::ResizeBilinear(
67 params, getTensorShape(_input), reinterpret_cast<const uint8_t *>(_input->buffer()),
68 getTensorShape(_output), reinterpret_cast<uint8_t *>(_output->buffer()));
71 case OperandType::UINT8:
72 case OperandType::BOOL8:
73 case OperandType::FLOAT16:
74 case OperandType::INT32:
75 case OperandType::INT64:
76 case OperandType::QUANT_INT8_SYMM:
77 std::runtime_error("ResizeBilinear NYI");
80 std::runtime_error("ResizeBilinear unsupported data type");
86 } // namespace backend