-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComputeAM.java
More file actions
43 lines (35 loc) · 1.08 KB
/
Copy pathComputeAM.java
File metadata and controls
43 lines (35 loc) · 1.08 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
// Associative memory to provide medium 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.
package s6regen;
public final class ComputeAM extends Compute{
private final AM memory;
ComputeAM(Reservoir r,int density){
super(r);
memory=new AM(r.computeSize,density);
}
@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();
}
}