提交 3da6c853 编写于 作者: H Helin Wang

use enum instead of define

上级 00d4d89a
...@@ -58,16 +58,18 @@ The selected trainer's call to `paddle_begin_init_params` will return with 1, an ...@@ -58,16 +58,18 @@ The selected trainer's call to `paddle_begin_init_params` will return with 1, an
## C Interface ## C Interface
```c ```c
#define PADDLE_ELEMENT_TYPE_INT32 0 typedef enum {
#define PADDLE_ELEMENT_TYPE_UINT32 1 PADDLE_ELEMENT_TYPE_INT32 = 0,
#define PADDLE_ELEMENT_TYPE_INT64 2 PADDLE_ELEMENT_TYPE_UINT32 = 1,
#define PADDLE_ELEMENT_TYPE_UINT64 3 PADDLE_ELEMENT_TYPE_INT64 = 2,
#define PADDLE_ELEMENT_TYPE_FLOAT32 4 PADDLE_ELEMENT_TYPE_UINT64 = 3,
#define PADDLE_ELEMENT_TYPE_FLOAT64 5 PADDLE_ELEMENT_TYPE_FLOAT32 = 4,
PADDLE_ELEMENT_TYPE_FLOAT64 = 5,
} paddle_element_type;
typedef struct { typedef struct {
char* name; char* name;
int element_type; paddle_element_type element_type;
void* content; void* content;
int content_len; int content_len;
} paddle_parameter, paddle_gradient; } paddle_parameter, paddle_gradient;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册