Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.11 KB | None | 0 0
  1. struct evaluable placeholder(int dims, int *shape);
  2. struct evaluable variable(int dims, int *shape);
  3. struct evaluable constant(int dims, int *shape);
  4. struct evaluable add(struct evaluable *a, struct evaluable *b);
  5. struct evaluable mul(struct evaluable *a, struct evaluable *b);
  6. struct evaluable dot(struct evaluable *a, struct evaluable *b, int dims_num, int *a_dims, int *b_dims);
  7. struct evaluable sum(struct evaluable *a, int dims_num = 0, int *dims = 0);
  8.  
  9. struct evaluable sigmoid(struct evaluable *a);
  10. struct evaluable tanh(struct evaluable *a);
  11.  
  12.  
  13. enum eval_type {
  14.     CONSTANT,
  15.     PLACEHOLDER,
  16.     VARIABLE,
  17.     OPERATOR   
  18. };
  19.  
  20. struct evaluable {
  21.     int dims;
  22.     int *shape;
  23.     eval_type type;
  24.     double *value;
  25.     void *object;
  26. };
  27.  
  28. enum op_type {
  29.     ELEMENT_WISE,
  30.     UNARY,
  31.     VARIABLE,
  32.     OPERATOR
  33. };
  34.  
  35. struct operator {
  36.     struct evaluable *args;
  37.  
  38.     op_type type;
  39. }
  40.  
  41. /*
  42.  
  43. operator
  44.     identity
  45.     add
  46.     subtract
  47.     mul(evaluable *left, evaluable *right)
  48.     dot(evaluable *left, evaluable *right, int left_dims_size, int *left_dims, int left_dims_size, int *left_dims)
  49.  
  50. mul()
  51.  
  52.  
  53. value -> double
  54.  mapped
  55.  
  56. map
  57.  
  58. gradient
  59.  
  60. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement