def log_cross_entropy_extended(x, x_theta, log_distribution, k_max, eps = 0.0):
p_k = x_theta["p_k"]
F = x.shape[1]
p_k = T.clip(p_k, eps, 1.0)
x_k = T.clip(x, 0, k_max)
p_k = T.reshape(p_k, (-1, k_max + 1))
x_k = T.reshape(x_k, (-1, 1))
y_cross_entropy = objectives.categorical_crossentropy(p_k, x_k)
y_cross_entropy = T.reshape(y_cross_entropy, (-1, F))
y_log_distribution = T.ge(x, k_max) * log_distribution(x - k_max, x_theta, eps)
# y = - T.lt(x, 0) * y_cross_entropy + y_log_distribution
y = - y_cross_entropy + T.lt(x, 0) * y_log_distribution
# y = - y_cross_entropy + y_log_distribution
return y
modeling.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录