DeepBaksuVision / BinaryConnect

4 stars 4 forks source link

[MH] 구현 버그 `torch.sign()`은 값을 {-1, 0, 1}로 만듦. #46

Closed ssaru closed 4 years ago

ssaru commented 4 years ago

아래와 같이 로직 변경 필요

>>> import torch
>>> a = torch.zeros((3,3))
>>> a
tensor([[0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.]])
>>> b = torch.sign(a)
>>> b
tensor([[0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.]])
>>> b[b==0] = 1
>>> b
tensor([[1., 1., 1.],
        [1., 1., 1.],
        [1., 1., 1.]])