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

Method cast_to

diffsynth/models/flux_controlnet.py:110–119  ·  view source on GitHub ↗
(weight, dtype=None, device=None, copy=False)

Source from the content-addressed store, hash-verified

108
109 def quantize(self):
110 def cast_to(weight, dtype=None, device=None, copy=False):
111 if device is None or weight.device == device:
112 if not copy:
113 if dtype is None or weight.dtype == dtype:
114 return weight
115 return weight.to(dtype=dtype, copy=copy)
116
117 r = torch.empty_like(weight, dtype=dtype, device=device)
118 r.copy_(weight)
119 return r
120
121 def cast_weight(s, input=None, dtype=None, device=None):
122 if input is not None:

Callers

nothing calls this directly

Calls 1

toMethod · 0.45

Tested by

no test coverage detected