2 * Copyright (c) 2020 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.
17 #ifndef __CIRCLE_EXPORTER_UTILS_H__
18 #define __CIRCLE_EXPORTER_UTILS_H__
20 #include "SerializedData.h"
22 #include <luci/IR/CircleNodes.h>
23 #include <luci/Service/ShapeDescription.h>
27 #include <mio/circle/schema_generated.h>
32 circle::ActivationFunctionType to_circle_actfunc(luci::FusedActFunc func);
33 circle::TensorType to_circle_tensortype(loco::DataType type);
34 circle::MirrorPadMode to_circle_mirrorpadmode(luci::MirrorPadMode mode);
35 circle::FullyConnectedOptionsWeightsFormat
36 to_circle_weightsformat(luci::CircleFullyConnected::WeightsFormat format);
37 circle::DimensionType to_circle_dimensiontype(luci::DimensionType type);
38 flatbuffers::Offset<void> to_circle_sparse_index_vector(flatbuffers::FlatBufferBuilder &fb,
39 const SparseIndexVector &sparse_idx_vec);
40 circle::SparseIndexVector to_circle_sparse_index_vector_type(luci::SparseIndexVectorType type);
47 circle::Padding getOpPadding(const loco::Padding2D *pad, const loco::Stride<2> *stride,
48 const ShapeDescription &ifm, const ShapeDescription &ofm);
49 circle::Padding getOpPadding(const luci::Padding pad);
51 using CircleTensorIndex = int32_t;
53 void set_tensor_index(loco::Node *node, const CircleTensorIndex &tensor_id);
54 CircleTensorIndex get_tensor_index(loco::Node *node);
58 #endif // __CIRCLE_EXPORTER_UTILS_H__