Horje
group normalization Code Example
group normalization
由此可以看出,GN和BN是有很多相似之处的,代码相比较BN改动只有一两行而已,论文给出的代码实现如下:
def GroupNorm(x, gamma, beta, G, eps=1e-5):
    # x: input features with shape [N,C,H,W]
    # gamma, beta: scale and offset, with shape [1,C,1,1]
    # G: number of groups for GN
    N, C, H, W = x.shape
    x = tf.reshape(x, [N, G, C // G, H, W])
    mean, var = tf.nn.moments(x, [2, 3, 4], keep dims=True)
    x = (x - mean) / tf.sqrt(var + eps)
    x = tf.reshape(x, [N, C, H, W])
    return x * gamma + beta




Whatever

Related
what is the difference in float and double in xcode Code Example what is the difference in float and double in xcode Code Example
alm Code Example alm Code Example
dip programming-language Code Example dip programming-language Code Example
useRef for diffing Code Example useRef for diffing Code Example
how to get value of ckedir Code Example how to get value of ckedir Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7