MCPcopy Create free account
hub / github.com/RosettaCommons/RFdiffusion / sample_truncated_normal

Function sample_truncated_normal

rfdiffusion/util_module.py:26–28  ·  view source on GitHub ↗
(shape, scale=1.0)

Source from the content-addressed store, hash-verified

24 return x
25
26 def sample_truncated_normal(shape, scale=1.0):
27 stddev = np.sqrt(scale/shape[-1])/.87962566103423978 # shape[-1] = fan_in
28 return stddev * truncated_normal(torch.rand(shape))
29
30 module.weight = torch.nn.Parameter( (sample_truncated_normal(module.weight.shape)) )
31 return module

Callers 2

init_lecun_normalFunction · 0.85
init_lecun_normal_paramFunction · 0.85

Calls 1

truncated_normalFunction · 0.85

Tested by

no test coverage detected