MCPcopy Create free account
hub / github.com/NVIDIA/vid2vid / forward

Method forward

models/models.py:35–40  ·  view source on GitHub ↗
(self, *inputs, **kwargs)

Source from the content-addressed store, hash-verified

33 self.pad_bs = self.bs_per_gpu * len(opt.gpu_ids) - opt.batchSize
34
35 def forward(self, *inputs, **kwargs):
36 inputs = self.add_dummy_to_tensor(inputs, self.pad_bs)
37 outputs = self.model(*inputs, **kwargs, dummy_bs=self.pad_bs)
38 if self.pad_bs == self.bs_per_gpu: # gpu 0 does 0 batch but still returns 1 batch
39 return self.remove_dummy_from_tensor(outputs, 1)
40 return outputs
41
42 def add_dummy_to_tensor(self, tensors, add_size=0):
43 if add_size == 0 or tensors is None: return tensors

Callers

nothing calls this directly

Calls 2

add_dummy_to_tensorMethod · 0.95

Tested by

no test coverage detected