ONE - On-device Neural Engine
Loading...
Searching...
No Matches
PALDepthwiseConv2d.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17#ifndef LUCI_INTERPRETER_PAL_DEPTHWISECONV2D_H
18#define LUCI_INTERPRETER_PAL_DEPTHWISECONV2D_H
19
20#include <tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h>
21#include <tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h>
22#include <tensorflow/lite/kernels/internal/reference/integer_ops/depthwise_conv.h>
23
25{
26template <typename T>
27static inline void
28DepthwiseConvPerChannel(const tflite::DepthwiseParams &params, const int32_t *output_multiplier,
29 const int32_t *output_shift, const tflite::RuntimeShape &input_shape,
30 const T *input_data, const tflite::RuntimeShape &filter_shape,
31 const T *filter_data, const tflite::RuntimeShape &bias_shape,
32 const int32_t *bias_data, const tflite::RuntimeShape &output_shape,
33 T *output_data, const tflite::RuntimeShape &scratchpad_shape,
34 T *scratchpad_data)
35{
36 {
37 // MARK: At this moment this operation is not supported
38 assert(false && "DepthwiseConvPerChannel NYI");
39 (void)params;
40 (void)output_multiplier;
41 (void)output_shift;
42 (void)input_shape;
43 (void)output_data;
44 (void)input_data;
45 (void)filter_shape;
46 (void)filter_data;
47 (void)bias_shape;
48 (void)bias_data;
49 (void)output_shape;
50 (void)output_data;
51 (void)scratchpad_shape;
52 (void)scratchpad_data;
53 }
54}
55
56template <>
58 const tflite::DepthwiseParams &params, const int32_t *output_multiplier,
59 const int32_t *output_shift, const tflite::RuntimeShape &input_shape, const int8_t *input_data,
60 const tflite::RuntimeShape &filter_shape, const int8_t *filter_data,
61 const tflite::RuntimeShape &bias_shape, const int32_t *bias_data,
62 const tflite::RuntimeShape &output_shape, int8_t *output_data,
63 const tflite::RuntimeShape &scratchpad_shape, int8_t *scratchpad_data)
64{
65 (void)scratchpad_shape;
66 (void)scratchpad_data;
67 tflite::reference_integer_ops::DepthwiseConvPerChannel(
68 params, output_multiplier, output_shift, input_shape, input_data, filter_shape, filter_data,
69 bias_shape, bias_data, output_shape, output_data);
70}
71
72static inline void SetupScratchpadTensor(luci_interpreter::Tensor *scratchpad,
73 const tflite::DepthwiseParams &params,
74 const luci_interpreter::DataType &input_data_type,
75 const tflite::RuntimeShape &input_shape,
76 const tflite::RuntimeShape &filter_shape,
77 const tflite::RuntimeShape &output_shape)
78
79{
80 (void)params;
81 (void)input_data_type;
82 (void)input_shape;
83 (void)filter_shape;
84 (void)output_shape;
85
86 scratchpad->set_allocatable(false);
87}
88
89} // namespace luci_interpreter_pal
90
91#endif // LUCI_INTERPRETER_PAL_DEPTHWISECONV2D_H
void set_allocatable(bool value)
Definition Tensor.h:168
const luci_interpreter::RuntimeShape output_shape
void DepthwiseConvPerChannel< int8_t >(const tflite::DepthwiseParams &params, const int32_t *output_multiplier, const int32_t *output_shift, const tflite::RuntimeShape &input_shape, const int8_t *input_data, const tflite::RuntimeShape &filter_shape, const int8_t *filter_data, const tflite::RuntimeShape &bias_shape, const int32_t *bias_data, const tflite::RuntimeShape &output_shape, int8_t *output_data, const tflite::RuntimeShape &scratchpad_shape, int8_t *scratchpad_data)
DataType
"scalar" value type
Definition DataType.h:32
void DepthwiseConvPerChannel(const DepthwiseConvParams &params, const int32_t *output_multiplier, const int32_t *output_shift, const Shape &input_shape, const int8_t *input_data, const Shape &filter_shape, const int8_t *filter_data, const Shape &bias_shape, const int32_t *bias_data, const Shape &output_shape, int8_t *output_data, ruy::Context *ruy_context)