提交 59c8a64f authored 作者: AdeB's avatar AdeB

Reorder arguments of h_softmax

上级 c8bc4549
...@@ -2052,11 +2052,10 @@ def relu(x, alpha=0): ...@@ -2052,11 +2052,10 @@ def relu(x, alpha=0):
return f1 * x + f2 * abs(x) return f1 * x + f2 * abs(x)
def h_softmax(x, batch_size, n_outputs, W1, b1, W2, b2, def h_softmax(x, batch_size, n_outputs, n_classes, n_outputs_per_class,
n_classes, n_outputs_per_class, target=None): W1, b1, W2, b2, target=None):
""" Two-level hierarchical softmax. """ Two-level hierarchical softmax.
Outputs are grouped in sqrt(n_outputs) classes.
The architecture is composed of two softmax layers: the first predicts the The architecture is composed of two softmax layers: the first predicts the
class of the input x while the second predicts the output of the input x in class of the input x while the second predicts the output of the input x in
the predicted class. the predicted class.
......
...@@ -1489,12 +1489,12 @@ def test_h_softmax(): ...@@ -1489,12 +1489,12 @@ def test_h_softmax():
y = tensor.ivector('y') y = tensor.ivector('y')
# This only computes the output corresponding to the target # This only computes the output corresponding to the target
y_hat_tg = h_softmax(x, batch_size, output_size, W1, b1, W2, b2, y_hat_tg = h_softmax(x, batch_size, output_size, h_softmax_level1_size,
h_softmax_level1_size, h_softmax_level2_size, y) h_softmax_level2_size, W1, b1, W2, b2, y)
# This computes all the outputs # This computes all the outputs
y_hat_all = h_softmax(x, batch_size, output_size, W1, b1, W2, b2, y_hat_all = h_softmax(x, batch_size, output_size, h_softmax_level1_size,
h_softmax_level1_size, h_softmax_level2_size) h_softmax_level2_size, W1, b1, W2, b2)
############# #############
# Compile functions # Compile functions
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论