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

Function convert_network

fp16/fp16util.py:77–85  ·  view source on GitHub ↗

Converts a network's parameters and buffers to dtype.

(network, dtype)

Source from the content-addressed store, hash-verified

75
76
77def convert_network(network, dtype):
78 """
79 Converts a network's parameters and buffers to dtype.
80 """
81 for module in network.modules():
82 if isinstance(module, torch.nn.modules.batchnorm._BatchNorm) and module.affine is True:
83 continue
84 convert_module(module, dtype)
85 return network
86
87
88class FP16Model(nn.Module):

Callers 1

__init__Method · 0.85

Calls 1

convert_moduleFunction · 0.85

Tested by

no test coverage detected