(self, x)
| 214 | self.output_linear = nn.Linear(W, output_ch) |
| 215 | |
| 216 | def forward(self, x): |
| 217 | input_pts, input_views = torch.split(x, [self.input_ch, self.input_ch_views], dim=-1) |
| 218 | h = input_pts |
| 219 | for i, l in enumerate(self.pts_linears): |
| 220 | h = self.pts_linears[i](h) |
| 221 | h = F.relu(h) |
| 222 | if i in self.skips: |
| 223 | h = torch.cat([input_pts, h], -1) |
| 224 | |
| 225 | if self.use_viewdirs: |
| 226 | alpha = self.alpha_linear(h) |
| 227 | feature = self.feature_linear(h) |
| 228 | h = torch.cat([feature, input_views], -1) |
| 229 | |
| 230 | for i, l in enumerate(self.views_linears): |
| 231 | h = self.views_linears[i](h) |
| 232 | h = F.relu(h) |
| 233 | |
| 234 | rgb = self.rgb_linear(h) |
| 235 | outputs = torch.cat([rgb, alpha], -1) |
| 236 | else: |
| 237 | outputs = self.output_linear(h) |
| 238 | |
| 239 | return outputs |
| 240 | |
| 241 | def load_weights_from_keras(self, weights): |
| 242 | assert self.use_viewdirs, "Not implemented if use_viewdirs=False" |
nothing calls this directly
no outgoing calls
no test coverage detected