본문 바로가기
Error Note

AttributeError: cannot assign module before Module.__init__() call

by ga.0_0.ga 2024. 2. 28.
728x90
반응형

- 에러 문구  

AttributeError: cannot assign module before Module.__init__() call

 

신경망 모델 설계시 super().__init__()을 빼먹어 생기는 문제입니다.

 

아래 처럼 코드에 추가해주면 해결 가능합니다.

class Block(nn.Module):
    def __init__(self, in_channel, hidden_channel, out_channel):
        super(CBlock, self).__init__()
        
        .
        .
        .
728x90
반응형

댓글