MCPcopy
hub / github.com/NVlabs/stylegan / apply_bias

Function apply_bias

training/networks_progan.py:57–62  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

55# Apply bias to the given activation tensor.
56
57def apply_bias(x):
58 b = tf.get_variable('bias', shape=[x.shape[1]], initializer=tf.initializers.zeros())
59 b = tf.cast(b, x.dtype)
60 if len(x.shape) == 2:
61 return x + b
62 return x + tf.reshape(b, [1, -1, 1, 1])
63
64#----------------------------------------------------------------------------
65# Leaky ReLU activation. Same as tf.nn.leaky_relu, but supports FP16.

Callers 3

blockFunction · 0.70
torgbFunction · 0.70
fromrgbFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected