def groups_norm2(A, n_orient):
 n_positions = (A.shape[0] // n_orient)
 return np.sum(np.power(A, 2, A).reshape(n_positions, (-1)), axis=1)

def groups_norm2 ( A , n_orient ) : n_positions = ( A . shape [ 0 ] // n_orient ) return np . sum ( np . power ( A , 2 , A ) . reshape ( n_positions , ( - 1 ) ) , axis = 1 )
compute squared l2 norms of groups inplace .