def abs_smooth_2(x):
"""Smoothed absolute function. Useful to compute an L1 smooth error.
Define as:
x^2 / 2 if abs(x) < 1
abs(x) - 0.5 if abs(x) > 1
an implementation that strictly stick to the formula
"""
absx = tf.abs(x)
r = array_ops.where(absx < 1, math_ops.square(x)/2.0, absx-0.5)
return r
评论列表
文章目录