IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
瀏覽代碼

Add tests for decoders on empty inputs.

master
Stanislaw Adaszewski 3 年之前
父節點
當前提交
f3371d996d
共有 1 個文件被更改,包括 52 次插入0 次删除
  1. +52
    -0
      tests/icosagon/test_decode.py

+ 52
- 0
tests/icosagon/test_decode.py 查看文件

@@ -158,3 +158,55 @@ def test_is_inner_product_symmetric_01():
for i in range(len(res_1)):
assert torch.all(res_1[i] - res_2[i] < 0.000001)
def test_empty_dedicom_decoder_01():
repr_ = torch.rand(0, 32)
dec = DEDICOMDecoder(32, 7, keep_prob=1.,
activation=torch.sigmoid)
res = [ dec(repr_, repr_, k) for k in range(7) ]
assert isinstance(res, list)
for i in range(len(res)):
assert res[i].shape == (0,)
def test_empty_dist_mult_decoder_01():
repr_ = torch.rand(0, 32)
dec = DistMultDecoder(32, 7, keep_prob=1.,
activation=torch.sigmoid)
res = [ dec(repr_, repr_, k) for k in range(7) ]
assert isinstance(res, list)
for i in range(len(res)):
assert res[i].shape == (0,)
def test_empty_bilinear_decoder_01():
repr_ = torch.rand(0, 32)
dec = BilinearDecoder(32, 7, keep_prob=1.,
activation=torch.sigmoid)
res = [ dec(repr_, repr_, k) for k in range(7) ]
assert isinstance(res, list)
for i in range(len(res)):
assert res[i].shape == (0,)
def test_empty_inner_product_decoder_01():
repr_ = torch.rand(0, 32)
dec = InnerProductDecoder(32, 7, keep_prob=1.,
activation=torch.sigmoid)
res = [ dec(repr_, repr_, k) for k in range(7) ]
assert isinstance(res, list)
for i in range(len(res)):
assert res[i].shape == (0,)

Loading…
取消
儲存