def _compute_content_grad(F, F_content, layer):
 Fl = F[layer]
 El = (Fl - F_content[layer])
 loss = ((El ** 2).sum() / 2)
 grad = (El * (Fl > 0))
 return (loss, grad)

def _compute_content_grad ( F , F_content , layer ) : Fl = F [ layer ] El = ( Fl - F_content [ layer ] ) loss = ( ( El ** 2 ) . sum ( ) / 2 ) grad = ( El * ( Fl > 0 ) ) return ( loss , grad )
computes content gradient and loss from activation features .