예제 #1
0
def test_average_pooling_plane_fprop():
    """
    Test that AveragePoolingPlane really does what we think it does
    on a forward pass.
    """
    applane = AveragePoolingPlane((2, 2), (4, 4))
    inp = np.arange(1, 17).reshape((4, 4))
    out = applane.fprop(inp)
    assert_array_almost_equal(
        out,
        np.array([[(1 + 2 + 5 + 6) / 4., (3 + 4 + 7 + 8) / 4.],
                  [(9 + 10 + 13 + 14) / 4., (11 + 12 + 15 + 16) / 4.]]))
예제 #2
0
def test_average_pooling_plane_fprop():
    """
    Test that AveragePoolingPlane really does what we think it does
    on a forward pass.
    """
    applane = AveragePoolingPlane((2, 2), (4, 4))
    inp = np.arange(1, 17).reshape((4, 4))
    out = applane.fprop(inp)
    assert_array_almost_equal(
        out,
        np.array(
            [[(1 + 2 + 5 + 6) / 4.0, (3 + 4 + 7 + 8) / 4.0], [(9 + 10 + 13 + 14) / 4.0, (11 + 12 + 15 + 16) / 4.0]]
        ),
    )
예제 #3
0
 def test_grad_raises_notimplemented(self):
     foo = AveragePoolingPlane((5, 5), (25, 25))
     foo.grad(np.empty((5, 5)), np.empty((25, 25)))
예제 #4
0
 def test_grad_raises_notimplemented(self):
     foo = AveragePoolingPlane((5, 5), (25, 25))
     foo.grad(np.empty((5, 5)), np.empty((25, 25)))
예제 #5
0
 def test_ratio_nondivisible(self):
     foo = AveragePoolingPlane((5, 5), (24, 24))
예제 #6
0
 def test_ratios_length_greater_than_2(self):
     foo = AveragePoolingPlane((5, 5, 5), (25, 25))
예제 #7
0
 def test_ratios_length_less_than_2(self):
     foo = AveragePoolingPlane((5, ), (25, 25))