提交 aa07814d 编写于 作者: M minqiyang

Add 3 uts

test=develop
上级 2e0b8713
...@@ -1909,39 +1909,34 @@ class TestBook(LayerTest): ...@@ -1909,39 +1909,34 @@ class TestBook(LayerTest):
return (out) return (out)
def test_kldiv_loss(self): def test_kldiv_loss(self):
program = Program() with program_guard(fluid.default_main_program(),
with program_guard(program): fluid.default_startup_program()):
x = layers.data(name='x', shape=[32, 128, 128], dtype="float32") x = layers.data(name='x', shape=[32, 128, 128], dtype="float32")
target = layers.data( target = layers.data(
name='target', shape=[32, 128, 128], dtype="float32") name='target', shape=[32, 128, 128], dtype="float32")
loss = layers.kldiv_loss(x=x, target=target, reduction='batchmean') loss = layers.kldiv_loss(x=x, target=target, reduction='batchmean')
self.assertIsNotNone(loss) return (loss)
print(str(program))
def test_temporal_shift(self): def test_temporal_shift(self):
program = Program() with program_guard(fluid.default_main_program(),
with program_guard(program): fluid.default_startup_program()):
x = layers.data(name="X", shape=[16, 4, 4], dtype="float32") x = layers.data(name="X", shape=[16, 4, 4], dtype="float32")
out = layers.temporal_shift(x, seg_num=4, shift_ratio=0.2) out = layers.temporal_shift(x, seg_num=4, shift_ratio=0.2)
self.assertIsNotNone(out) return (out)
print(str(program))
def test_shuffle_channel(self): def test_shuffle_channel(self):
program = Program() with program_guard(fluid.default_main_program(),
with program_guard(program): fluid.default_startup_program()):
x = layers.data(name="X", shape=[16, 4, 4], dtype="float32") x = layers.data(name="X", shape=[16, 4, 4], dtype="float32")
out = layers.shuffle_channel(x, group=4) out = layers.shuffle_channel(x, group=4)
self.assertIsNotNone(out) return (out)
print(str(program))
def test_pixel_shuffle(self): def test_pixel_shuffle(self):
program = Program() with program_guard(fluid.default_main_program(),
with program_guard(program): fluid.default_startup_program()):
x = layers.data(name="X", shape=[9, 4, 4], dtype="float32") x = layers.data(name="X", shape=[9, 4, 4], dtype="float32")
out = layers.pixel_shuffle(x, upscale_factor=3) out = layers.pixel_shuffle(x, upscale_factor=3)
self.assertIsNotNone(out) return (out)
print(str(program))
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册