MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / test_FixedUnPooling

Method test_FixedUnPooling

tensorpack/models/models_test.py:32–47  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

30
31class TestPool(TestModel):
32 def test_FixedUnPooling(self):
33 h, w = 3, 4
34 scale = 2
35 mat = np.random.rand(h, w, 3).astype('float32')
36 input = self.make_variable(mat)
37 input = tf.reshape(input, [1, h, w, 3])
38 output = FixedUnPooling('unpool', input, scale)
39 res = self.eval(output)
40 self.assertEqual(res.shape, (1, scale * h, scale * w, 3))
41
42 # mat is on corner
43 ele = res[0, ::scale, ::scale, 0]
44 self.assertTrue((ele == mat[:, :, 0]).all())
45 # the rest are zeros
46 res[0, ::scale, ::scale, :] = 0
47 self.assertTrue((res == 0).all())
48
49# Below was originally for the BilinearUpsample layer used in the HED example
50# def test_BilinearUpSample(self):

Callers

nothing calls this directly

Calls 4

FixedUnPoolingFunction · 0.85
make_variableMethod · 0.80
evalMethod · 0.80
allMethod · 0.80

Tested by

no test coverage detected