MCPcopy Create free account
hub / github.com/THUDM/GLM / BN_convert_float

Function BN_convert_float

fp16/fp16util.py:39–49  ·  view source on GitHub ↗

Utility function for network_to_half(). Retained for legacy purposes.

(module)

Source from the content-addressed store, hash-verified

37
38
39def BN_convert_float(module):
40 """
41 Utility function for network_to_half().
42
43 Retained for legacy purposes.
44 """
45 if isinstance(module, torch.nn.modules.batchnorm._BatchNorm) and module.affine is True:
46 module.float()
47 for child in module.children():
48 BN_convert_float(child)
49 return module
50
51
52def network_to_half(network):

Callers 1

network_to_halfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected