Skip to content

Commit

Permalink
enum defined before typedef to ensure compatibility with c++
Browse files Browse the repository at this point in the history
  • Loading branch information
steczol authored and nopeslide committed Mar 9, 2021
1 parent 8b6f9ed commit 52b2eb4
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions include/operators/operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,29 @@
#include "onnx.pb-c.h"
#include <errno.h>

enum operator_status {
OP_OK = 0,
OP_ENOSYS = ENOSYS, // Function not implemented
OP_ENOMEM = ENOMEM, // Out of memory
OP_EINVAL = EINVAL, // Invalid argument
OP_EDOM = EDOM, // Math argument out of domain of func
OP_ERANGE = ERANGE // Math result not representable
};

// TODO Remove unused code
typedef enum operator_status operator_status;
typedef struct node_context node_context;
typedef struct node_context node_context;
typedef operator_status (*operator_preparer)(node_context *ctx);
typedef operator_status (*operator_executer)(node_context *ctx);
typedef operator_executer (*operator_resolver)(node_context *ctx);



// TODO Move this to a file named operator_interface
struct node_context {
Onnx__NodeProto *onnx_node;
Onnx__TensorProto **inputs;
Onnx__TensorProto **outputs;
operator_executer executer;
void *executer_context;
};

enum operator_status {
OP_OK = 0,
OP_ENOSYS = ENOSYS, // Function not implemented
OP_ENOMEM = ENOMEM, // Out of memory
OP_EINVAL = EINVAL, // Invalid argument
OP_EDOM = EDOM, // Math argument out of domain of func
OP_ERANGE = ERANGE // Math result not representable
Onnx__NodeProto *onnx_node;
Onnx__TensorProto **inputs;
Onnx__TensorProto **outputs;
operator_executer executer;
void *executer_context;
};

#endif

0 comments on commit 52b2eb4

Please sign in to comment.