MCPcopy Create free account
hub / github.com/apple/ml-sharp / prepare_feature_input

Method prepare_feature_input

src/sharp/models/initializer.py:116–125  ·  view source on GitHub ↗

Prepare the feature input to the Guassian predictor.

(self, image: torch.Tensor, depth: torch.Tensor)

Source from the content-addressed store, hash-verified

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.

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected