MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / forward

Method forward

models/diffusion/base.py:244–269  ·  view source on GitHub ↗
(
            self,
            x_0: torch.Tensor,
            text: torch.Tensor | None = None,
            semantic: torch.Tensor | None = None,
            loss_mask: torch.Tensor | None = None,
            current_steps: int = -1,
            points=None,
            batches=None,
            sampling_condition=None,
            print_loss: bool = False
    )

Source from the content-addressed store, hash-verified

242 return loss
243
244 def forward(
245 self,
246 x_0: torch.Tensor,
247 text: torch.Tensor | None = None,
248 semantic: torch.Tensor | None = None,
249 loss_mask: torch.Tensor | None = None,
250 current_steps: int = -1,
251 points=None,
252 batches=None,
253 sampling_condition=None,
254 print_loss: bool = False
255 ) -> torch.Tensor:
256 steps = self.sample_timesteps(x_0.shape[0], x_0.device)
257 loss = self.p_loss(
258 x_0=x_0,
259 steps=steps,
260 loss_mask=loss_mask,
261 text=text,
262 semantic=semantic,
263 current_steps=current_steps,
264 points=points,
265 batches=batches,
266 sampling_condition=sampling_condition,
267 print_loss=print_loss
268 )
269 return loss
270
271 @torch.inference_mode()
272 def sample(self, *args, **kwargs):

Callers

nothing calls this directly

Calls 2

sample_timestepsMethod · 0.95
p_lossMethod · 0.95

Tested by

no test coverage detected