ONE - On-device Neural Engine
Loading...
Searching...
No Matches
PALBroadcastTo.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 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_BROADCASTTO_H
18#define LUCI_INTERPRETER_PAL_BROADCASTTO_H
19
20#include <tensorflow/lite/kernels/internal/reference/broadcast_to.h>
21
23{
24
25static inline void BroadcastTo(const tflite::RuntimeShape &input_shape, const char *input_data,
26 const tflite::RuntimeShape &output_shape, char *output_data,
27 TfLiteType data_type)
28{
29 // BroadcastTo op supports up to 8 kMaxDims in tensorflow.
30 // but, currently we support up to 5 dims because there is a compiler bug in 7.4.0 gcc version.
31 // https://github.com/tensorflow/tensorflow/blob/932af96ae91b4fa647dc50ad0f14c3e0b60affab/tensorflow/lite/kernels/broadcast_to.cc#L118
32 constexpr int kMaxDims = 5;
33 tflite::reference_ops::BroadcastTo<kMaxDims>(input_shape, input_data, output_shape, output_data,
34 data_type);
35}
36
37} // namespace luci_interpreter_pal
38
39#endif // LUCI_INTERPRETER_PAL_BROADCASTTO_H
const luci_interpreter::RuntimeShape output_shape
void BroadcastTo(const Shape &input_shape, T *input_data, const Shape &output_shape, T *output_data)