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

불러오는 중...
취소
저장