-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCore.py
57 lines (38 loc) · 944 Bytes
/
Core.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import numpy as np
class Op:
def __init__(self, name):
self.name = name
pass
def __repr__(self):
return 'Op:' + self.name
def forward(self, x):
pass
def backward(self, grad_y):
pass
def __call__(self, x):
return self.forward(x)
class Layer:
def __init__(self, name):
self.name = name
self.param = None
pass
def __repr__(self):
return 'layer:' + self.name
def forward(self, x):
pass
def backward(self, grad_y):
pass
def __call__(self, x):
return self.forward(x)
class Loss:
def __init__(self, name):
self.name = name
pass
def __repr__(self):
return 'loss:' + self.name
def forward(self, x, y):
pass
def backward(self, grad_y):
pass
def __call__(self, x):
return self.forward(x)