コード例 #1
0
ファイル: transfer.py プロジェクト: zhezhe123/breze
def safe_softmax(x):
    """Return the softmax with result truly between 0 and 1."""
    y = _softmax(x)
    y = T.clip(y, 1e-7, 1 - 1e-7)
    return y
コード例 #2
0
ファイル: transfer.py プロジェクト: zhezhe123/breze
def det_softmax(mean, var):
    mean_flat = mean.reshape((mean.shape[0] * mean.shape[1], mean.shape[2]))
    softmaxed = _softmax(mean_flat).reshape(mean.shape)

    return T.clip(softmaxed, 1e-8, 1 - 1e-8), T.zeros_like(var) + 1e-8