Fast style transfer networks change style by re-normalising feature maps. Features are (N, C, H, W) arrays. For each example and channel , define the instance statistics over the spatial positions,
Implement:
cin(phi_c, gamma_s, beta_s, eps=1e-5): conditional instance normalisation with per-style parameters of shape (C,): .adain(phi_c, phi_s, eps=1e-5): adaptive instance normalisation in the original parameter-free form of [HB17], where the style's own statistics play the roles of and : , with computed from the content features and from the style features phi_s. The style features may have a different spatial size, and their batch dimension is either or (one style for the whole batch).Both return an array with the shape of phi_c.