-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlayer_fwd.go
More file actions
108 lines (99 loc) · 1.91 KB
/
layer_fwd.go
File metadata and controls
108 lines (99 loc) · 1.91 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package gocunets
import (
"errors"
"fmt"
//"github.com/dereklstinson/gocunets/layers"
)
//ForwardProp does the forward prop for a layer
func (l *Layer) forwardprop() error {
// return l.h.w.Work(func() error {
fwdws := l.workspacefwd
x, y := l.x.Tensor, l.y.Tensor
err := l.h.Sync()
if err != nil {
fmt.Println("Error During First sync")
return err
}
if l.cnn != nil {
err = l.cnn.ForwardProp(l.h.Handler, fwdws, x, y)
if err != nil {
return err
}
err = l.h.Sync()
if err != nil {
fmt.Println("Sync Error in CNN")
}
return nil
}
if l.drop != nil {
err = l.drop.ForwardProp(l.h.Handler, x, y)
if err != nil {
return err
}
err = l.h.Sync()
if err != nil {
fmt.Println("Sync Error in Drop")
}
return nil
}
if l.activation != nil {
err = l.activation.ForwardProp(l.h.Handler, x, y)
if err != nil {
return err
}
err = l.h.Sync()
if err != nil {
fmt.Println("Sync Error in Activation")
}
return nil
}
if l.pool != nil {
err = l.pool.ForwardProp(l.h.Handler, x, y)
if err != nil {
return err
}
err = l.h.Sync()
if err != nil {
fmt.Println("Sync Error in Pool")
}
return nil
}
if l.reshape != nil {
err = l.reshape.ForwardProp(l.h.Handler, x, y)
if err != nil {
return err
}
err = l.h.Sync()
if err != nil {
fmt.Println("Sync Error in reshape")
}
return nil
}
if l.batch != nil {
err = l.batch.ForwardProp(l.h.Handler, x, y)
if err != nil {
fmt.Println("Error In Batch ")
return err
}
err = l.h.Sync()
if err != nil {
fmt.Println("Sync Error in BatchNorm")
}
return nil
}
if l.cnntranspose != nil {
err = l.cnntranspose.ForwardProp(l.h.Handler, fwdws, x, y)
if err != nil {
fmt.Println("Error in Transpose ForwardProp ")
return err
}
err = l.h.Sync()
if err != nil {
fmt.Println("Sync Error in CnnTranspose")
return err
}
return nil
}
return errors.New("Layer Not Set Up")
// })
}