-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComputeAMThresholdGated.java
44 lines (36 loc) · 1.18 KB
/
ComputeAMThresholdGated.java
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
// Associative memory to provide long term memory.
// Reads input address from one gathered source and scatters the result.
// Reads input from another source as an address and stores a further source after
// threshold gating.
package s6regen;
public final class ComputeAMThresholdGated extends Compute{
private final AMThresholdGated memory;
ComputeAMThresholdGated(Reservoir r,int density,float threshold){
super(r);
memory=new AMThresholdGated(r.computeSize,density,threshold);
}
@Override
public void compute() {
float[] workA=reservoir.computeBuffers[0];
float[] workB=reservoir.computeBuffers[1];
float[] workC=reservoir.computeBuffers[2];
reservoir.gather(workA);
reservoir.gather(workB);
reservoir.gather(workC);
memory.recallVec(workA, workA);
reservoir.scatter(workA);
memory.trainVec(workC, workB);
}
@Override
public int weightSize() {
return 3*reservoir.sizeGather()+reservoir.sizeScatter();
}
@Override
public int buffersRequired() {
return 3;
}
@Override
public void resetHeldState(){
memory.reset();
}
}