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!
Browse Source

Add test_sparse_multi_dgca()

master
Stanislaw Adaszewski 4 years ago
parent
commit
7f085b372a
1 changed files with 20 additions and 1 deletions
  1. +20
    -1
      tests/decagon_pytorch/test_convolve.py

+ 20
- 1
tests/decagon_pytorch/test_convolve.py View File

@@ -124,4 +124,23 @@ def test_sparse_dropout_grap_conv_activation():
def test_sparse_multi_dgca():
pass
latent_torch = None
latent_tf = []
for i in range(11):
keep_prob = i/10. + np.finfo(np.float32).eps
latent_torch = sparse_dropout_graph_conv_activation_torch(keep_prob) \
if latent_torch is None \
else latent_torch + sparse_dropout_graph_conv_activation_torch(keep_prob)
latent_tf.append(sparse_dropout_graph_conv_activation_tf(keep_prob))
latent_torch = torch.nn.functional.normalize(latent_torch, p=2, dim=1)
latent_tf = tf.add_n(latent_tf)
latent_tf = tf.nn.l2_normalize(latent_tf, dim=1)
latent_torch = latent_torch.detach().numpy()
latent_tf = latent_tf.eval(session = tf.Session())
assert np.all(latent_torch - latent_tf < .000001)

Loading…
Cancel
Save