MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / forward

Method forward

diffsynth/vram_management/layers.py:65–71  ·  view source on GitHub ↗
(self, x, *args, **kwargs)

Source from the content-addressed store, hash-verified

63 self.state = 1
64
65 def forward(self, x, *args, **kwargs):
66 if self.onload_dtype == self.computation_dtype and self.onload_device == self.computation_device:
67 weight, bias = self.weight, self.bias
68 else:
69 weight = cast_to(self.weight, self.computation_dtype, self.computation_device)
70 bias = None if self.bias is None else cast_to(self.bias, self.computation_dtype, self.computation_device)
71 return torch.nn.functional.linear(x, weight, bias)
72
73
74def enable_vram_management_recursively(model: torch.nn.Module, module_map: dict, module_config: dict, max_num_param=None, overflow_module_config: dict = None, total_num_param=0):

Callers

nothing calls this directly

Calls 1

cast_toFunction · 0.85

Tested by

no test coverage detected