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!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
834B

  1. from decagon_pytorch.layer import OneHotInputLayer, \
  2. DecagonLayer, \
  3. DecodeLayer
  4. from decagon_pytorch.decode import DEDICOMDecoder
  5. from decagon_pytorch.data import Data
  6. import torch
  7. def test_decode_layer_01():
  8. d = Data()
  9. d.add_node_type('Dummy', 100)
  10. d.add_relation_type('Dummy Relation 1', 0, 0,
  11. torch.rand((100, 100), dtype=torch.float32).round().to_sparse())
  12. in_layer = OneHotInputLayer(d)
  13. d_layer = DecagonLayer(d, in_layer, 32)
  14. last_layer_repr = d_layer()
  15. dec = DecodeLayer(d, last_layer = d_layer, decoder_class = DEDICOMDecoder)
  16. pred_adj_matrices = dec(last_layer_repr)
  17. assert isinstance(pred_adj_matrices, dict)
  18. assert len(pred_adj_matrices) == 1
  19. assert isinstance(pred_adj_matrices[0, 0], list)
  20. assert len(pred_adj_matrices[0, 0]) == 1