Prepare the feature input to the Guassian predictor.
(self, image: torch.Tensor, depth: torch.Tensor)
| 114 | self.feature_input_stop_grad = feature_input_stop_grad |
| 115 | |
| 116 | def prepare_feature_input(self, image: torch.Tensor, depth: torch.Tensor) -> torch.Tensor: |
| 117 | """Prepare the feature input to the Guassian predictor.""" |
| 118 | if self.feature_input_stop_grad: |
| 119 | image = image.detach() |
| 120 | depth = depth.detach() |
| 121 | |
| 122 | normalized_disparity = self.disparity_factor / depth |
| 123 | features_in = torch.cat([image, normalized_disparity], dim=1) |
| 124 | features_in = 2.0 * features_in - 1.0 |
| 125 | return features_in |
| 126 | |
| 127 | def forward(self, image: torch.Tensor, depth: torch.Tensor) -> InitializerOutput: |
| 128 | """Construct Gaussian base values and prepare feature input. |