@@ -93,11 +93,12 @@ prop_simple_conv_forwards = once $
9393 , 0.0, 0.0, 0.0, 0.0
9494 , 0.0, 0.0, 0.0, 0.0
9595 , 0.0, 0.0, 0.0, 0.0 ] :: HStatic.L 4 4)
96− --expectedKernel = (HStatic.matrix
97− -- [ 0.0, 0.0, 0.0, -2.0
98− -- ,-2.0, 1.0, 1.0, -5.0
99− -- ,-3.0, -1.0, 1.0, -5.0
100− -- ,-5.0, 0.0, 0.0, -7.0 ] :: HStatic.L 4 4)
96+
97+ expectedGradient = (HStatic.matrix
98+ [ 1.0, 0.0, 0.0, 2.0
99+ , 2.0, 0.0, 0.0, 5.0
100+ , 3.0, 0.0, 0.0, 4.0
101+ , 4.0, 0.0, 0.0, 6.0 ] :: HStatic.L 4 4)
101102
102103 convLayer = Convolution myKernel zeroKernel :: Convolution 1 4 2 2 1 1
103104
@@ -128,12 +129,13 @@ prop_simple_conv_forwards = once $
128129 expectBack = (HStatic.matrix
129130 [ 1.0, 0.0, 0.0
130131 , 0.0, -2.0,-1.0] :: HStatic.L 2 3)
131− (nc, inX) = runIdentity $ runBackards 1 convLayer input grad :: ( Convolution 1 4 2 2 1 1 , S' ('D2 2 3))
132+ (nc, inX) = runIdentity $ runBackards convLayer input grad
132133
133134 in case (out, inX, nc) of
134− (S3D' out' , S2D' inX', Convolution _ _)
135+ (S3D' out' , S2D' inX', Convolution' backGrad)
135136 -> ((HStatic.extract <$> expect) === (HStatic.extract <$> vecToList out'))
136137 .&&. ((HStatic.extract expectBack) === (HStatic.extract inX'))
138+ .&&. ((HStatic.extract expectedGradient) === (HStatic.extract backGrad))
137139 -- Temporarily disabled, as l2 adjustment puts in off 5%
138140 -- .&&. HStatic.extract expectedKernel === HStatic.extract kernel'
139141
@@ -203,11 +205,12 @@ prop_single_conv_forwards = once $
203205 , 0.0, 0.0, 0.0, 0.0
204206 , 0.0, 0.0, 0.0, 0.0
205207 , 0.0, 0.0, 0.0, 0.0 ] :: HStatic.L 4 4)
206− --expectedKernel = (HStatic.matrix
207− -- [ 0.0, 0.0, 0.0, -2.0
208− -- ,-2.0, 1.0, 1.0, -5.0
209− -- ,-3.0, -1.0, 1.0, -5.0
210− -- ,-5.0, 0.0, 0.0, -7.0 ] :: HStatic.L 4 4)
208+
209+ expectedGradient = (HStatic.matrix
210+ [ 1.0, 0.0, 0.0, 2.0
211+ , 2.0, 0.0, 0.0, 5.0
212+ , 3.0, 0.0, 0.0, 4.0
213+ , 4.0, 0.0, 0.0, 6.0 ] :: HStatic.L 4 4)
211214
212215 convLayer = Convolution myKernel zeroKernel :: Convolution 1 4 2 2 1 1
213216
@@ -238,13 +241,13 @@ prop_single_conv_forwards = once $
238241 expectBack = (HStatic.matrix
239242 [ 1.0, 0.0, 0.0
240243 , 0.0, -2.0,-1.0] :: HStatic.L 2 3)
241− (nc, inX) = runIdentity $ runBackards 1 convLayer input grad :: ( Convolution 1 4 2 2 1 1 , S' ('D3 2 3 1))
244+ (nc, inX) = runIdentity $ runBackards convLayer input grad
242245
243246 in case (out, inX, nc) of
244− (S3D' out' , S3D' inX', Convolution _ _)
247+ (S3D' out' , S3D' inX', Convolution' backGrad)
245248 -> ((HStatic.extract <$> expect) === (HStatic.extract <$> vecToList out'))
246249 .&&. ([HStatic.extract expectBack] === (HStatic.extract <$> vecToList inX'))
247− -- .&&. HStatic.extract expectedKernel === HStatic.extract kernel'
250+ .&&. ((HStatic.extract expectedGradient) === (HStatic.extract backGrad))
248251
249252return []
250253tests :: IO Bool