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
26
enum class
OperandLifeTime
: int32_t {
27
TEMPORARY_VARIABLE
= 0,
28
MODEL_INPUT
= 1,
29
MODEL_OUTPUT
= 2,
30
CONSTANT_COPY
= 3,
31
CONSTANT_REFERENCE
= 4,
32
NO_VALUE
= 5,
33
};
34
35
struct
DataLocation
final {
36
uint32_t
poolIndex
;
37
uint32_t
offset
;
38
uint32_t
length
;
39
};
40
41
struct
Operand
final {
42
OperandType
type
;
43
float
scale
;
44
int32_t
zeroPoint
;
45
46
std::vector<uint32_t>
dimensions
;
47
48
DataLocation
location
;
49
50
uint32_t
numberOfConsumers
;
51
OperandLifeTime
lifetime
;
52
};
53
54
// Returns the amount of space needed to store a value of the dimensions and
55
// type of this operand.
56
inline
uint32_t
sizeOfData
(
const
Operand
&operand)
57
{
58
return
sizeOfData
(operand.
type
, operand.
dimensions
);
59
}
60
61
#endif
// __OPERAND_H__
OperandType.h
OperandType
OperandType
Definition
OperandType.h:24
OperandLifeTime
OperandLifeTime
Definition
Operand.h:26
OperandLifeTime::NO_VALUE
@ NO_VALUE
OperandLifeTime::TEMPORARY_VARIABLE
@ TEMPORARY_VARIABLE
OperandLifeTime::MODEL_OUTPUT
@ MODEL_OUTPUT
OperandLifeTime::MODEL_INPUT
@ MODEL_INPUT
OperandLifeTime::CONSTANT_COPY
@ CONSTANT_COPY
OperandLifeTime::CONSTANT_REFERENCE
@ CONSTANT_REFERENCE
sizeOfData
uint32_t sizeOfData(const Operand &operand)
Definition
Operand.h:56
DataLocation
Definition
Operand.h:35
DataLocation::poolIndex
uint32_t poolIndex
Definition
Operand.h:36
DataLocation::length
uint32_t length
Definition
Operand.h:38
DataLocation::offset
uint32_t offset
Definition
Operand.h:37
Operand
Definition
Operand.h:41
Operand::scale
float scale
Definition
Operand.h:43
Operand::zeroPoint
int32_t zeroPoint
Definition
Operand.h:44
Operand::dimensions
std::vector< uint32_t > dimensions
Definition
Operand.h:46
Operand::numberOfConsumers
uint32_t numberOfConsumers
Definition
Operand.h:50
Operand::lifetime
OperandLifeTime lifetime
Definition
Operand.h:51
Operand::type
OperandType type
Definition
Operand.h:42
Operand::location
DataLocation location
Definition
Operand.h:48
compiler
ann-ref
src
Operand.h
Generated by
1.9.8