-
Notifications
You must be signed in to change notification settings - Fork 0
/
engine.h
36 lines (31 loc) · 935 Bytes
/
engine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef ENGINE_H
#define ENGINE_H
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
typedef struct Value {
float data;
char *operation;
struct Value **previous;
char *label;
float grad;
bool requiresGrad;
} Value;
// Constructors
Value *newValue(float data, char *operation, struct Value **previous, char *label, float grad, bool requiresGrad);
Value **createValuePointerArray(Value *v1, Value *v2);
// Helpers
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
float randomUniform(float min, float max);
void displayValue(Value *v);
// Operations
Value *sum(Value *v1, Value *v2, char *label);
Value *mul(Value *v1, Value *v2, char *label);
Value *htan(Value *v, char *label);
Value *sigmoid(Value *v, char *label);
Value *ReLU(Value *v, char *label);
Value *LeakyReLU(Value *v, char *label);
Value *euler(Value *v, char *label);
Value *pow2(Value *v, char *label);
#endif // ENGINE_H