(input)
| 35 | return tf.nn.relu(x) |
| 36 | |
| 37 | def batchnorm(input): |
| 38 | with tf.variable_scope(self.name): |
| 39 | # this block looks like it has 3 inputs on the graph unless we do this |
| 40 | input = tf.identity(input) |
| 41 | |
| 42 | channels = input.get_shape()[3] |
| 43 | offset = tf.get_variable("offset", [channels], dtype=tf.float32, initializer=tf.zeros_initializer()) |
| 44 | scale = tf.get_variable("scale", [channels], dtype=tf.float32, initializer=tf.random_normal_initializer(1.0, 0.02)) |
| 45 | mean, variance = tf.nn.moments(input, axes=[0, 1, 2], keep_dims=False) |
| 46 | variance_epsilon = 1e-5 |
| 47 | normalized = tf.nn.batch_normalization(input, mean, variance, offset, scale, variance_epsilon=variance_epsilon) |
| 48 | return normalized |
| 49 | |
| 50 | def lrelu(x): |
| 51 | a = self.a |
nothing calls this directly
no outgoing calls
no test coverage detected