def op_norm2(s_x_, axis_=-1, use_mean_=False, keepdims_=True):
'''
Square of L2 norm
Args:
s_x_: input (batch of) vector
axis_: int or tuple of int
use_mean_: cause mean of square to be one instead of sum
'''
op_sum = T.sum if not use_mean_ else T.mean
return op_sum(T.sqr(s_x_), axis=axis_, keepdims=keepdims_)
评论列表
文章目录