MCPcopy Create free account
hub / github.com/CompVis/diff2flow / nonlinearity

Function nonlinearity

diff2flow/kl_autoencoder.py:35–38  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

33
34
35def nonlinearity(x):
36 # this incurs additional memory: return x*torch.sigmoid(x)
37 # so we switch to pytorch's in-built function and perform silu in-place:
38 return nn.SiLU(inplace=True)(x)
39
40
41def Normalize(in_channels, num_groups=32):

Callers 3

forwardMethod · 0.85
forwardMethod · 0.85
forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected