MCPcopy Index your code
hub / github.com/CompVis/diff2flow / apply_cond_dropout

Method apply_cond_dropout

diff2flow/trainer_module.py:440–446  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

438 return z
439
440 def apply_cond_dropout(self, x):
441 if self.training and self.cond_dropout > 0.:
442 mask = torch.bernoulli(torch.ones(x.shape[0]) * self.cond_dropout).bool()
443 if self.uncond.device != x.device:
444 self.uncond = self.uncond.to(x.device)
445 x[mask] = self.uncond
446 return x
447
448 def extract_from_batch(self, batch):
449 """

Callers 1

training_stepMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected