ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Reshape.cpp
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
#include "
Reshape.h
"
18
19
#include "
mir/ShapeRange.h
"
20
21
#include <cstring>
22
23
namespace
mir_interpreter
24
{
25
26
void
Reshape
(
const
mir::TensorVariant
&input,
mir::TensorVariant
&output)
27
{
28
assert(input.getShape().numElements() == output.getShape().numElements());
29
30
mir::ShapeRange
input_range(input.getShape());
31
auto
in_iter = input_range.
begin
();
32
const
size_t
elem_size = input.getElementSize();
33
34
for
(
const
auto
&out_index :
mir::ShapeRange
(output.getShape()))
35
std::memcpy(output.at(out_index), input.at(*in_iter++), elem_size);
36
}
37
38
}
// namespace mir_interpreter
ShapeRange.h
mir::ShapeRange
Definition
ShapeRange.h:82
mir::ShapeRange::begin
ShapeIter begin()
Definition
ShapeRange.h:88
mir::TensorVariant
Definition
TensorVariant.h:33
mir_interpreter
Definition
MirInterpreter.h:27
mir_interpreter::Reshape
void Reshape(const mir::TensorVariant &input, mir::TensorVariant &output)
Definition
Reshape.cpp:26
Reshape.h
compiler
mir-interpreter
src
ops
Reshape.cpp
Generated by
1.9.8