(self)
| 30 | |
| 31 | class 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): |
nothing calls this directly
no test coverage detected