ONE - On-device Neural Engine
Loading...
Searching...
No Matches
PALAbs.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 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_MICRO_EXECUTE_PAL_ABS_COMMON_H
18
#define ONERT_MICRO_EXECUTE_PAL_ABS_COMMON_H
19
20
#include "
OMStatus.h
"
21
#include "
core/OMRuntimeShape.h
"
22
23
#include <cmath>
24
25
namespace
onert_micro
26
{
27
namespace
execute
28
{
29
namespace
pal
30
{
31
32
template
<
typename
T>
33
inline
OMStatus
Abs
(
const
core::OMRuntimeShape
&shape,
const
T *input_data, T *output_data)
34
{
35
const
uint32_t flat_size = shape.
flatSize
();
36
37
if
(flat_size == -1)
38
return
UnknownError
;
39
40
assert(input_data !=
nullptr
);
41
assert(output_data !=
nullptr
);
42
43
for
(uint32_t i = 0; i < flat_size; ++i)
44
{
45
output_data[i] = std::abs(input_data[i]);
46
}
47
48
return
Ok
;
49
}
50
51
}
// namespace pal
52
}
// namespace execute
53
}
// namespace onert_micro
54
55
#endif
// ONERT_MICRO_EXECUTE_PAL_ABS_COMMON_H
OMRuntimeShape.h
OMStatus.h
onert_micro::core::OMRuntimeShape
Definition
OMRuntimeShape.h:34
onert_micro::core::OMRuntimeShape::flatSize
int flatSize() const
Definition
OMRuntimeShape.h:64
onert_micro::execute::pal::Abs
OMStatus Abs(const core::OMRuntimeShape &shape, const T *input_data, T *output_data)
Definition
PALAbs.h:33
onert_micro
Definition
OMMemoryManager.h:26
onert_micro::OMStatus
OMStatus
Definition
OMStatus.h:24
onert_micro::UnknownError
@ UnknownError
Definition
OMStatus.h:30
onert_micro::Ok
@ Ok
Definition
OMStatus.h:25
onert-micro
onert-micro
include
pal
common
PALAbs.h
Generated by
1.9.8