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

    [Pytorch] nn.module์„ ์ƒ์†๋ฐ›์„ ๋•Œ super().__init__()์„ ํ•˜๋Š” ์ด์œ 

    [Pytorch] nn.module์„ ์ƒ์†๋ฐ›์„ ๋•Œ super().__init__()์„ ํ•˜๋Š” ์ด์œ 

    ํŒŒ์ดํ† ์น˜์—์„œ ํด๋ž˜์Šค๋กœ Layer๋‚˜ Model์„ ๊ตฌํ˜„ํ•ด์ฃผ๋ฉด ํ•ญ์ƒ ์ƒ์„ฑ์ž์—์„œ super(class์ด๋ฆ„, self).__init__()์„ ์ž…๋ ฅํ•ด์ค๋‹ˆ๋‹ค. ์™œ ์ด๊ฒƒ์„ ์ž…๋ ฅํ•ด์•ผ ํ•˜๋Š”์ง€ ๊ถ๊ธˆํ•˜์—ฌ ์•Œ์•„๋ณด์•˜์Šต๋‹ˆ๋‹ค. super().__init__()์ด ์—†๋‹ค๋ฉด? import torch class Test(torch.nn.Module): def __init__(self): self.linear = torch.nn.Linear(3,2) def forward(self,x): return self.linear(x) Test๋ฅผ ์œ„ํ•ด ๊ต‰์žฅํžˆ ๊ฐ„๋‹จํ•œ torch.nn.Module์„ ์ƒ์†๋ฐ›๋Š” ํด๋ž˜์Šค๋ฅผ ๋งŒ๋“ค์–ด๋ณด์•˜์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ด ํด๋ž˜์Šค๋ฅผ ํ™œ์šฉํ•ด ๋ชจ๋ธ์„ ๋งŒ๋“ค์–ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. model = Test() ์ƒ์„ฑ์„ ํ•˜๊ฒŒ ๋œ๋‹ค๋ฉด AttributeErro..