<s> '''<STR_LIT>''' <EOL> from keras import backend as K <EOL> def gram_matrix ( x ) : <EOL> assert K . ndim ( x ) == <NUM_LIT:3> <EOL> features = K . batch_flatten ( x ) <EOL> gram = K . dot ( features , K . transpose ( features ) ) <EOL> return gram <EOL> def neural_style_loss ( style , combination , num_channels , img_width , img_height ) : <EOL> assert K . ndim ( style ) == <NUM_LIT:3> <EOL> assert K . ndim ( combination ) == <NUM_LIT:3> <EOL> S = gram_matrix ( style ) <EOL> C = gram_matrix ( combination ) <EOL> size = img_width * img_height <EOL> return K . sum ( K . square ( S - C ) ) / ( <NUM_LIT> * ( num_channels ** <NUM_LIT:2> ) * ( size ** <NUM_LIT:2> ) ) </s>
