(self, x)
| 102 | self.output_linear = nn.Linear(W, output_ch) |
| 103 | |
| 104 | def forward(self, x): |
| 105 | input_pts, input_views = torch.split(x, [self.input_ch, self.input_ch_views], dim=-1) |
| 106 | h = input_pts |
| 107 | for i, l in enumerate(self.pts_linears): |
| 108 | h = self.pts_linears[i](h) |
| 109 | h = F.relu(h) |
| 110 | if i in self.skips: |
| 111 | h = torch.cat([input_pts, h], -1) |
| 112 | |
| 113 | if self.use_viewdirs: |
| 114 | alpha = self.alpha_linear(h) |
| 115 | uncert = self.act_uncertainty(self.uncertainty_linear(h)) + self.beta_min |
| 116 | feature = self.feature_linear(h) |
| 117 | h = torch.cat([feature, input_views], -1) |
| 118 | |
| 119 | for i, l in enumerate(self.views_linears): |
| 120 | h = self.views_linears[i](h) |
| 121 | h = F.relu(h) |
| 122 | |
| 123 | rgb = self.rgb_linear(h) |
| 124 | outputs = torch.cat([rgb, alpha, uncert], -1) |
| 125 | else: |
| 126 | outputs = self.output_linear(h) |
| 127 | |
| 128 | return outputs |
| 129 | |
| 130 | def load_weights_from_keras(self, weights): |
| 131 | assert self.use_viewdirs, "Not implemented if use_viewdirs=False" |
nothing calls this directly
no outgoing calls
no test coverage detected