ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OperationUtils.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 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 __ONERT_BACKEND_RUY_OPS_OPERATION_UTILS_H__
18#define __ONERT_BACKEND_RUY_OPS_OPERATION_UTILS_H__
19
21#include <ir/DataType.h>
22#include <ir/Padding.h>
24
25#include <ruy/Shape.h>
26#include <ruy/Types.h>
27
28#include <limits>
29
31using namespace onert::util;
32
34{
35
37{
38 if (tensor == nullptr)
39 return nnfw::ruy::Shape();
40
41 const ir::Shape &shape = tensor->get_info().shape();
42 auto rank = shape.rank();
43 nnfw::ruy::Shape ret(rank);
44 auto data = ret.DimsData();
45 for (int i = 0; i < rank; ++i)
46 {
47 data[i] = shape.dim(i);
48 }
49 return ret;
50}
51
72
73nnfw::ruy::PaddingType getPaddingType(ir::PaddingType ir_padding_type);
74
75} // namespace onert::backend::ruy::ops
76
77#endif // __ONERT_BACKEND_RUY_OPS_OPERATION_UTILS_H__
OperandType
Definition OperandType.h:24
int32_t * DimsData()
Definition Shape.h:112
A tensor class that is portable for other backends.
PaddingType
Definition Types.h:44
FusedActivationFunctionType
Definition Types.h:34
nnfw::ruy::Shape getTensorShape(const IPortableTensor *tensor)
nnfw::ruy::FusedActivationFunctionType convertActivationType(const ir::Activation activation)