@@ -548,6 +548,7 @@ public void testBasicNetworkRunAWhileThenHalt() {
548
548
@ Test
549
549
public void testRegionHierarchies () {
550
550
Parameters p = NetworkTestHarness .getParameters ();
551
+ p .setPotentialRadius (16 );
551
552
p = p .union (NetworkTestHarness .getNetworkDemoTestEncoderParams ());
552
553
p .set (KEY .RANDOM , new MersenneTwister (42 ));
553
554
@@ -1007,6 +1008,29 @@ public void testObservableWithCoordinateEncoder_NEGATIVE() {
1007
1008
assertTrue (hasErrors (tester ));
1008
1009
}
1009
1010
1011
+ @ Test
1012
+ public void testPotentialRadiusFollowsInputWidth () {
1013
+ Parameters p = NetworkTestHarness .getParameters ();
1014
+ p = p .union (NetworkTestHarness .getNetworkDemoTestEncoderParams ());
1015
+ p .set (KEY .INPUT_DIMENSIONS , new int [] { 200 });
1016
+ p .set (KEY .RANDOM , new MersenneTwister (42 ));
1017
+
1018
+ Network network = Network .create ("test network" , p )
1019
+ .add (Network .createRegion ("r1" )
1020
+ .add (Network .createLayer ("2" , p )
1021
+ .add (Anomaly .create ())
1022
+ .add (new TemporalMemory ())
1023
+ .add (new SpatialPooler ())
1024
+ .close ()));
1025
+
1026
+ Region r1 = network .lookup ("r1" );
1027
+ Layer <?> layer2 = r1 .lookup ("2" );
1028
+
1029
+ int width = layer2 .calculateInputWidth ();
1030
+ assertEquals (200 , width );
1031
+ assertEquals (200 , layer2 .getConnections ().getPotentialRadius ());
1032
+ }
1033
+
1010
1034
///////////////////////////////////////////////////////////////////////////////////
1011
1035
// Tests of Calculate Input Width for inter-regional and inter-layer calcs //
1012
1036
///////////////////////////////////////////////////////////////////////////////////
@@ -1063,7 +1087,6 @@ public void testCalculateInputWidth_NoPrevLayer_UpstreamRegion_without_TM() {
1063
1087
1064
1088
int width = layer2 .calculateInputWidth ();
1065
1089
assertEquals (2048 , width );
1066
-
1067
1090
}
1068
1091
1069
1092
@ Test
@@ -1077,7 +1100,6 @@ public void testCalculateInputWidth_NoPrevLayer_NoPrevRegion_andTM() {
1077
1100
.add (Network .createLayer ("2" , p )
1078
1101
.add (Anomaly .create ())
1079
1102
.add (new TemporalMemory ())
1080
- //.add(new SpatialPooler())
1081
1103
.close ()));
1082
1104
1083
1105
Region r1 = network .lookup ("r1" );
@@ -1098,14 +1120,15 @@ public void testCalculateInputWidth_NoPrevLayer_NoPrevRegion_andSPTM() {
1098
1120
.add (Network .createLayer ("2" , p )
1099
1121
.add (Anomaly .create ())
1100
1122
.add (new TemporalMemory ())
1101
- .add (new SpatialPooler ())
1123
+ .add (new SpatialPooler ())
1102
1124
.close ()));
1103
1125
1104
1126
Region r1 = network .lookup ("r1" );
1105
1127
Layer <?> layer2 = r1 .lookup ("2" );
1106
1128
1107
1129
int width = layer2 .calculateInputWidth ();
1108
1130
assertEquals (8 , width );
1131
+ assertEquals (8 , layer2 .getConnections ().getPotentialRadius ());
1109
1132
}
1110
1133
1111
1134
@ Test
@@ -1126,6 +1149,7 @@ public void testCalculateInputWidth_NoPrevLayer_NoPrevRegion_andNoTM() {
1126
1149
1127
1150
int width = layer2 .calculateInputWidth ();
1128
1151
assertEquals (8 , width );
1152
+ assertEquals (8 , layer2 .getConnections ().getPotentialRadius ());
1129
1153
}
1130
1154
1131
1155
@ Test
0 commit comments