ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Operand.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
3 * Copyright (C) 2017 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef __OPERAND_H__
19#define __OPERAND_H__
20
21#include "OperandType.h"
22
23#include <cstdint>
24#include <vector>
25
26enum class OperandLifeTime : int32_t {
28 MODEL_INPUT = 1,
29 MODEL_OUTPUT = 2,
30 CONSTANT_COPY = 3,
32 NO_VALUE = 5,
33};
34
35struct DataLocation final {
36 uint32_t poolIndex;
37 uint32_t offset;
38 uint32_t length;
39};
40
41struct Operand final {
43 float scale;
44 int32_t zeroPoint;
45
46 std::vector<uint32_t> dimensions;
47
49
52};
53
54// Returns the amount of space needed to store a value of the dimensions and
55// type of this operand.
56inline uint32_t sizeOfData(const Operand &operand)
57{
58 return sizeOfData(operand.type, operand.dimensions);
59}
60
61#endif // __OPERAND_H__
OperandType
Definition OperandType.h:24
OperandLifeTime
Definition Operand.h:26
uint32_t sizeOfData(const Operand &operand)
Definition Operand.h:56
uint32_t poolIndex
Definition Operand.h:36
uint32_t length
Definition Operand.h:38
uint32_t offset
Definition Operand.h:37
float scale
Definition Operand.h:43
int32_t zeroPoint
Definition Operand.h:44
std::vector< uint32_t > dimensions
Definition Operand.h:46
uint32_t numberOfConsumers
Definition Operand.h:50
OperandLifeTime lifetime
Definition Operand.h:51
OperandType type
Definition Operand.h:42
DataLocation location
Definition Operand.h:48