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!
Ver código fonte

Add tests for decoders on empty inputs.

master
Stanislaw Adaszewski 4 anos atrás
pai
commit
f3371d996d
1 arquivos alterados com 52 adições e 0 exclusões
  1. +52
    -0
      tests/icosagon/test_decode.py

+ 52
- 0
tests/icosagon/test_decode.py Ver arquivo

@@ -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,)

Carregando…
Cancelar
Salvar