VinAIResearch / HyperInverter

HyperInverter: Improving StyleGAN Inversion via Hypernetwork (CVPR 2022)
https://di-mi-ta.github.io/HyperInverter/
BSD 3-Clause "New" or "Revised" License
116 stars 13 forks source link

confused with some code. #7

Open tengshaofeng opened 2 years ago

tengshaofeng commented 2 years ago

Hi, sorry to bother you again. I find some code in class WeightRegressor like:

  out = torch.matmul(out, self.w1) + self.b1
  out = out.view(bs, self.in_channels, self.hidden_dim)
  out = torch.matmul(out, self.w2) + self.b2
  kernel = out.view(bs, self.out_channels, self.in_channels, self.kernel_size, self.kernel_size)  # like bz, 512, 512, 3, 3

why not use linear layer, like

w1 = nn.Linear(128, 65536) w2 = nn.Linear(65536, 2359296) out = w1(out) out = w2(out) kernel = out.view(bs, self.out_channels, self.in_channels, self.kernel_size, self.kernel_size)