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!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

test_normalize.py 919B

4 år sedan
12345678910111213141516171819202122232425
  1. import decagon_pytorch.normalize
  2. import decagon.deep.minibatch
  3. import numpy as np
  4. def test_normalize_adjacency_matrix_square():
  5. mx = np.random.rand(10, 10)
  6. mx[mx < .5] = 0
  7. mx = np.ceil(mx)
  8. res_torch = decagon_pytorch.normalize.normalize_adjacency_matrix(mx)
  9. res_tf = decagon.deep.minibatch.EdgeMinibatchIterator.preprocess_graph(None, mx)
  10. assert len(res_torch) == len(res_tf)
  11. for i in range(len(res_torch)):
  12. assert np.all(res_torch[i] == res_tf[i])
  13. def test_normalize_adjacency_matrix_nonsquare():
  14. mx = np.random.rand(5, 10)
  15. mx[mx < .5] = 0
  16. mx = np.ceil(mx)
  17. res_torch = decagon_pytorch.normalize.normalize_adjacency_matrix(mx)
  18. res_tf = decagon.deep.minibatch.EdgeMinibatchIterator.preprocess_graph(None, mx)
  19. assert len(res_torch) == len(res_tf)
  20. for i in range(len(res_torch)):
  21. assert np.all(res_torch[i] == res_tf[i])