ONE - On-device Neural Engine
Loading...
Searching...
No Matches
TensorContext.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 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
19
22
23namespace nnkit
24{
25namespace support
26{
27namespace tf
28{
29
31
34{ // for input
37
38 const ParsedTensor *parsed_tensor = _tensors.at(n).get();
39 float *data = reinterpret_cast<float *>(_data_map.data(parsed_tensor));
40 auto overlay = make_overlay<float, LexicalLayout>(shape(n), data);
41
42 f(*this, n, overlay);
43}
44
47{ // for output
50
51 const ParsedTensor *parsed_tensor = _tensors.at(n).get();
52 float *data = reinterpret_cast<float *>(_data_map.data(parsed_tensor));
53 auto overlay = make_overlay<float, LexicalLayout>(shape(n), data);
54
55 f(*this, n, overlay);
56}
57
58} // namespace tf
59} // namespace support
60} // namespace nnkit
nncc::core::ADT::tensor::Shape shape(uint32_t n) const override
void getConstFloatTensor(uint32_t n, const nnkit::TensorContext::TypedReader< float > &f) const override
void getMutableFloatTensor(uint32_t n, const nnkit::TensorContext::TypedAccessor< float > &f) override
uint8_t * data(const ParsedTensor *parsed_tensor)
Class to store tensor information parsed from test.info file under moco/test/tf.
Overlay< T > make_overlay(const Shape &shape, T *base)
Definition Overlay.h:48
std::function< void(const TensorContext &, uint32_t n, const nncc::core::ADT::tensor::Reader< T > &)> TypedReader
std::function< void(const TensorContext &, uint32_t n, nncc::core::ADT::tensor::Accessor< T > &)> TypedAccessor