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

Fixes for bool sparse tensors.

master
Stanislaw Adaszewski 4 년 전
부모
커밋
1ee89509ee
3개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. +2
    -1
      src/icosagon/normalize.py
  2. +2
    -2
      tests/icosagon/test_normalize.py
  3. +1
    -1
      tests/icosagon/test_trainprep.py

+ 2
- 1
src/icosagon/normalize.py 파일 보기

@@ -41,7 +41,8 @@ def _sparse_coo_tensor(indices, values, size):
torch.uint8: torch.sparse.ByteTensor,
torch.long: torch.sparse.LongTensor,
torch.int: torch.sparse.IntTensor,
torch.short: torch.sparse.ShortTensor }[values.dtype]
torch.short: torch.sparse.ShortTensor,
torch.bool: torch.sparse.ByteTensor }[values.dtype]
return ctor(indices, values, size)


+ 2
- 2
tests/icosagon/test_normalize.py 파일 보기

@@ -46,14 +46,14 @@ def test_add_eye_sparse_04():
def test_norm_adj_mat_one_node_type_sparse_01():
adj_mat = torch.rand((10, 10))
adj_mat = (adj_mat > .5)
adj_mat = (adj_mat > .5).to(torch.float32)
adj_mat = adj_mat.to_sparse()
_ = norm_adj_mat_one_node_type_sparse(adj_mat)
def test_norm_adj_mat_one_node_type_sparse_02():
adj_mat_dense = torch.rand((10, 10))
adj_mat_dense = (adj_mat_dense > .5)
adj_mat_dense = (adj_mat_dense > .5).to(torch.float32)
adj_mat_sparse = adj_mat_dense.to_sparse()
adj_mat_sparse = norm_adj_mat_one_node_type_sparse(adj_mat_sparse)
adj_mat_dense = norm_adj_mat_one_node_type_dense(adj_mat_dense)


+ 1
- 1
tests/icosagon/test_trainprep.py 파일 보기

@@ -108,7 +108,7 @@ def test_prepare_adj_mat_02():
def test_prepare_relation_type_01():
adj_mat = (torch.rand((10, 10)) > .5)
adj_mat = (torch.rand((10, 10)) > .5).to(torch.float32)
r = RelationType('Test', 0, 0, adj_mat, True)
ratios = TrainValTest(.8, .1, .1)
_ = prepare_relation_type(r, ratios, False)


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