ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Common.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 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
#include <cassert>
18
19
#include "
Common.h
"
20
21
namespace
mir_interpreter
22
{
23
24
using namespace
mir
;
25
26
Index
shift
(
const
Index
&in_index,
const
Shape
&shift_from)
27
{
28
Index
index = in_index;
29
assert(index.rank() == shift_from.
rank
());
30
for
(int32_t d = 0; d < in_index.
rank
(); ++d)
31
{
32
index.at(d) = index.at(d) + shift_from.
dim
(d);
33
}
34
return
index;
35
}
36
37
}
// namespace mir_interpreter
mir::Index
Definition
Index.h:32
mir::Index::rank
int32_t rank() const
Definition
Index.h:43
mir::Shape
Definition
Shape.h:31
mir::Shape::dim
int32_t & dim(int32_t axis) noexcept
Definition
Shape.h:47
mir::Shape::rank
int32_t rank() const
Definition
Shape.h:43
mir_interpreter
Definition
MirInterpreter.h:27
mir_interpreter::shift
Index shift(const Index &in_index, const Shape &shift_from)
Definition
Common.cpp:26
mir
Definition
Attributes.h:25
Common.h
compiler
mir-interpreter
src
ops
Common.cpp
Generated by
1.9.8