ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Utils.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 __RECORD_MINMAX_UTILS_H__
18#define __RECORD_MINMAX_UTILS_H__
19
20#include <luci/IR/CircleNodes.h>
21
22#include <vector>
23#include <string>
24
25namespace record_minmax
26{
27
28// Return total number of elements of the node's output tensor
29uint32_t numElements(const luci::CircleNode *node);
30
31// Return the node's output tensor size in bytes
32size_t getTensorSize(const luci::CircleNode *node);
33
34// Read data from file into buffer with specified size in bytes
35void readDataFromFile(const std::string &filename, std::vector<char> &data, size_t data_size);
36
37// Throw exception if input has one of the following conditions.
38// 1. Have unknown dimension
39// 2. Number of elements is 0
40void checkInputDimension(const luci::CircleInput *input);
41
42} // namespace record_minmax
43
44#endif // __RECORD_MINMAX_UTILS_H__
CircleNode used for Input of the Graph.
Definition CircleInput.h:36
void checkInputDimension(const luci::CircleInput *input)
Definition Utils.cpp:29
size_t getTensorSize(const luci::CircleNode *node)
Definition Utils.cpp:57
void readDataFromFile(const std::string &filename, std::vector< char > &data, size_t data_size)
Definition Utils.cpp:65
uint32_t numElements(const luci::CircleNode *node)
Definition Utils.cpp:41