ONE - On-device Neural Engine
Loading...
Searching...
No Matches
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
33namespace onert
34{
35namespace backend
36{
37namespace ruy
38{
39namespace ops
40{
41
43{
44 if (tensor == nullptr)
45 return nnfw::ruy::Shape();
46
47 const ir::Shape &shape = tensor->get_info().shape();
48 auto rank = shape.rank();
49 nnfw::ruy::Shape ret(rank);
50 auto data = ret.DimsData();
51 for (int i = 0; i < rank; ++i)
52 {
53 data[i] = shape.dim(i);
54 }
55 return ret;
56}
57
78
79nnfw::ruy::PaddingType getPaddingType(ir::PaddingType ir_padding_type);
80
81} // namespace ops
82} // namespace ruy
83} // namespace backend
84} // namespace onert
85
86#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)