Open Deep Learning API
Loading...
Searching...
No Matches
odla_value.h
Go to the documentation of this file.
1//===- odla_value.h -------------------------------------------------------===//
2//
3// Copyright (C) 2019-2020 Alibaba Group Holding Limited.
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 _ODLA_VALUE_H_
19#define _ODLA_VALUE_H_
20
21#include <ODLA/odla_common.h>
22
27#ifdef __cplusplus
28extern "C" {
29#endif
30
32#define ODLA_MAX_DIMENSION 10
33
35#define ODLA_MAX_OUTPUTS 64
36
37typedef struct {
38 odla_element_type data_type;
39 union {
40 odla_int32 val_int32;
41 odla_uint32 val_uint32;
42 odla_int64 val_int64;
43 odla_uint64 val_uint64;
44 odla_float32 val_fp32;
45 odla_float64 val_fp64;
46 odla_string val_str;
47 };
49
51typedef struct {
52 // size = -1: undefined size
53 odla_int32 size;
54 // dims[i] = -1: undefined dimension
57
59typedef struct {
60 odla_element_type element_type;
61 odla_value_shape shape;
63
65typedef struct _odla_value* odla_value;
66
68typedef struct {
69 odla_size_t size;
72
74typedef struct _odla_value_id* odla_value_id;
75
77typedef struct {
78 odla_size_t size;
81
83
89extern ODLA_API_EXPORT odla_status ODLA_API_CALL
90odla_SetValueData(odla_value value, const odla_void* data_ptr);
91
93
99extern ODLA_API_EXPORT odla_status ODLA_API_CALL
100odla_SetValueDataById(const odla_value_id value_id, const odla_void* data_ptr);
101
103
109extern ODLA_API_EXPORT odla_status ODLA_API_CALL
110odla_GetRawDataPtr(const odla_value value, odla_void** data_ptr);
112
118extern ODLA_API_EXPORT odla_status ODLA_API_CALL
120
122
128extern ODLA_API_EXPORT odla_status ODLA_API_CALL
130
132
139 const odla_value_id value_id, odla_value_type* value_type);
140
142
148extern ODLA_API_EXPORT odla_status ODLA_API_CALL
150
152
158extern ODLA_API_EXPORT odla_status ODLA_API_CALL
160
162
167extern ODLA_API_EXPORT odla_status ODLA_API_CALL
169
171
176extern ODLA_API_EXPORT odla_status ODLA_API_CALL
178
180
185extern ODLA_API_EXPORT odla_status ODLA_API_CALL
187
189
194extern ODLA_API_EXPORT odla_status ODLA_API_CALL
196
198
203extern ODLA_API_EXPORT odla_status ODLA_API_CALL
205
207
210extern ODLA_API_EXPORT void ODLA_API_CALL odla_Dump(odla_value value);
211
212#ifdef __cplusplus
213} // C extern
214#endif
215
216#endif // _ODLA_VALUE_H_
__INT32_TYPE__ odla_int32
Definition: odla_common.h:66
#define ODLA_API_EXPORT
API export directives.
Definition: odla_common.h:172
odla_status
Return status.
Definition: odla_common.h:140
__INT64_TYPE__ odla_int64
Definition: odla_common.h:67
__UINT32_TYPE__ odla_uint32
Definition: odla_common.h:70
double odla_float64
Definition: odla_common.h:91
const char * odla_string
Definition: odla_common.h:92
__SIZE_TYPE__ odla_size_t
size_t
Definition: odla_common.h:134
void odla_void
void
Definition: odla_common.h:137
float odla_float32
Definition: odla_common.h:90
__UINT64_TYPE__ odla_uint64
Definition: odla_common.h:71
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_FindValueById(const odla_value_id value_id, odla_value *value)
Return the value by id.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_SetValueDataById(const odla_value_id value_id, const odla_void *data_ptr)
Set a value data by id.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_GetValueId(const odla_value value, odla_value_id *value_id)
Get the id of a value.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_SetValueAsOutputById(const odla_value_id value_id)
Set a value by id as a computation output.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_GetValueType(const odla_value value, odla_value_type *value_type)
Get the type of a value.
#define ODLA_MAX_DIMENSION
Supported maximum dimension size.
Definition: odla_value.h:32
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_GetRawDataPtr(const odla_value value, odla_void **data_ptr)
Get the raw data ptr from value.
#define ODLA_MAX_OUTPUTS
Supported maximum output size.
Definition: odla_value.h:35
struct _odla_value_id * odla_value_id
Unique id of each value.
Definition: odla_value.h:74
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_ReleaseValueById(odla_value_id value_id)
Release a value by id.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_GetValueTypeById(const odla_value_id value_id, odla_value_type *value_type)
Get the type of a value by id.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_SetValueAsOutput(odla_value value)
Set a value as a computation output.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_ReleaseValue(odla_value value)
Release a value.
ODLA_API_EXPORT void ODLA_API_CALL odla_Dump(odla_value value)
Dump the data of the odla_value for debugging purpose.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_SetValuesAsOutput(odla_values values)
Set multi values as a computation outputs.
struct _odla_value * odla_value
Value definition.
Definition: odla_value.h:65
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_SetValueData(odla_value value, const odla_void *data_ptr)
Set a value data.
ODLA_API_EXPORT odla_status ODLA_API_CALL odla_GetValueDataById(const odla_value_id value_id, odla_void *data_ptr)
Get a value data by id.
Multiple value ids.
Definition: odla_value.h:77
Shape of value.
Definition: odla_value.h:51
Type of value.
Definition: odla_value.h:59
Multiple values.
Definition: odla_value.h:68