insung3511 / ecg-dbn

ECG Classification of Normal and Abnormal with GB-DBN Model (pytorch)
MIT License
0 stars 0 forks source link

Matmul issue with 180 * 80 and 80 * 180 size tensors #3

Closed insung3511 closed 2 years ago

insung3511 commented 2 years ago

Matrix multiply 을 위해서 사이즈를 고의적으로 맞춰주었으나 자꾸 동일한 오류가 발생함. 아래는 오류 내용.

RuntimeError: mat1 and mat2 shapes cannot be multiplied (180x180 and 1x80)

GBRBM.py 에서 p_h_given_v 함수 내에서 sigmoid 함수 내에서 오류 발생.

Error code :

    def p_h_given_v(self, v):
        w = self.w.clone()
        if v.dim() != 2:
            v = v.clone().view(self.vis_num, 1)

        if list(v.size()) == list(w.size()):
            v = v.clone().view(list(w.size())[1], list(w.size())[0])

        print("<-----------", w.size(), "<==============", v.size())
        print("----------->", w.dim(), "==============>", v.dim())

        return torch.matmul(
            w, v
        )   + self.b