FcaNet
FcaNet copied to clipboard
关于 the L73-L83 in model/layer.py 中learnable tensor的问题
你好!
在使用
# learnable DCT init
self.register_parameter('weight', self.get_dct_filter(height, width, mapper_x, mapper_y, channel))
# learnable random init
self.register_parameter('weight', torch.rand(channel, height, width))
这两种初始化方法时,会出现以下bug:
TypeError: cannot assign 'torch.FloatTensor' object to parameter 'weight' (torch.nn.Parameter or None required)
help plz :)
btw,我只是简单将其改为
self.register_parameter('weight', nn.Parameter(self.get_dct_filter(height, width, mapper_x, mapper_y, channel)))
不知道是否与作者的原意等价😂
等价的,或是直接使用:
self.weight = nn.Parameter(self.get_dct_filter(height, width, mapper_x, mapper_y, channel))