MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / BN_convert_float

Function BN_convert_float

DeepSpeedExample/megatron/fp16/fp16util.py:42–52  ·  view source on GitHub ↗

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

(module)

Source from the content-addressed store, hash-verified

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

Callers 1

network_to_halfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected