util.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:squeezeDet-hand 作者: fyhtea 项目源码 文件源码
def safe_exp(w, thresh):
  """Safe exponential function for tensors."""

  slope = np.exp(thresh)
  with tf.variable_scope('safe_exponential'):
    lin_region = tf.to_float(w > thresh)

    lin_out = slope*(w - thresh + 1.)
    exp_out = tf.exp(w)

    out = lin_region*lin_out + (1.-lin_region)*exp_out
  return out
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号