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!
소스 검색

test_normalize

master
Stanislaw Adaszewski 4 년 전
부모
커밋
d835b049b0
1개의 변경된 파일25개의 추가작업 그리고 0개의 파일을 삭제
  1. +25
    -0
      tests/decagon_pytorch/test_normalize.py

+ 25
- 0
tests/decagon_pytorch/test_normalize.py 파일 보기

@@ -0,0 +1,25 @@
import decagon_pytorch.normalize
import decagon.deep.minibatch
import numpy as np
def test_normalize_adjacency_matrix_square():
mx = np.random.rand(10, 10)
mx[mx < .5] = 0
mx = np.ceil(mx)
res_torch = decagon_pytorch.normalize.normalize_adjacency_matrix(mx)
res_tf = decagon.deep.minibatch.EdgeMinibatchIterator.preprocess_graph(None, mx)
assert len(res_torch) == len(res_tf)
for i in range(len(res_torch)):
assert np.all(res_torch[i] == res_tf[i])
def test_normalize_adjacency_matrix_nonsquare():
mx = np.random.rand(5, 10)
mx[mx < .5] = 0
mx = np.ceil(mx)
res_torch = decagon_pytorch.normalize.normalize_adjacency_matrix(mx)
res_tf = decagon.deep.minibatch.EdgeMinibatchIterator.preprocess_graph(None, mx)
assert len(res_torch) == len(res_tf)
for i in range(len(res_torch)):
assert np.all(res_torch[i] == res_tf[i])

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