(x, gamma=None, beta=None, epsilon=1e-5)
| 230 | |
| 231 | |
| 232 | def adaptive_instance_normalization(x, gamma=None, beta=None, epsilon=1e-5): |
| 233 | # modified from https://github.com/taki0112/MUNIT-Tensorflow/blob/master/ops.py |
| 234 | # x: (N, H, W, C), gamma: (N, C), beta: (N, C) |
| 235 | |
| 236 | c_mean, c_var = tf.nn.moments(x, axes=[1, 2], keep_dims=True) |
| 237 | c_std = tf.sqrt(c_var + epsilon) |
| 238 | x = (x - c_mean) / c_std |
| 239 | |
| 240 | return adaptive_scaling(x, gamma, beta) |
| 241 | |
| 242 | |
| 243 | # ============================================================================== |
nothing calls this directly
no test coverage detected