(x, units, use_bias=True, sn=False, scope='fully_0')
| 66 | return x |
| 67 | |
| 68 | def fully_conneted(x, units, use_bias=True, sn=False, scope='fully_0'): |
| 69 | with tf.variable_scope(scope): |
| 70 | x = flatten(x) |
| 71 | shape = x.get_shape().as_list() |
| 72 | channels = shape[-1] |
| 73 | |
| 74 | if sn : |
| 75 | w = tf.get_variable("kernel", [channels, units], tf.float32, |
| 76 | initializer=weight_init, regularizer=weight_regularizer) |
| 77 | if use_bias : |
| 78 | bias = tf.get_variable("bias", [units], |
| 79 | initializer=tf.constant_initializer(0.0)) |
| 80 | |
| 81 | x = tf.matmul(x, spectral_norm(w)) + bias |
| 82 | else : |
| 83 | x = tf.matmul(x, spectral_norm(w)) |
| 84 | |
| 85 | else : |
| 86 | x = tf.layers.dense(x, units=units, kernel_initializer=weight_init, kernel_regularizer=weight_regularizer, use_bias=use_bias) |
| 87 | |
| 88 | return x |
| 89 | |
| 90 | def flatten(x) : |
| 91 | return tf.layers.flatten(x) |
nothing calls this directly
no test coverage detected