提交 4e603bfc authored 作者: James Bergstra's avatar James Bergstra

Fixed 'reason' string in crossentropy_to_crossentropy_with_softmax

上级 72fc5105
...@@ -848,13 +848,15 @@ def crossentropy_to_crossentropy_with_softmax(env): ...@@ -848,13 +848,15 @@ def crossentropy_to_crossentropy_with_softmax(env):
x, = sm.owner.inputs x, = sm.owner.inputs
new_nll, new_sm, new_am = crossentropy_softmax_argmax_1hot_with_bias(x, new_nll, new_sm, new_am = crossentropy_softmax_argmax_1hot_with_bias(x,
tensor.zeros_like(x[0]), one_of_n) tensor.zeros_like(x[0]), one_of_n)
env.replace_all_validate([(nll, new_nll),(sm, new_sm)], reason="Merge") env.replace_all_validate([(nll, new_nll),(sm, new_sm)],
reason="crossentropy_to_crossentropy_with_softmax")
return True return True
if sm.owner and sm.owner.op == softmax_with_bias: if sm.owner and sm.owner.op == softmax_with_bias:
x, b = sm.owner.inputs x, b = sm.owner.inputs
new_nll, new_sm, new_am = crossentropy_softmax_argmax_1hot_with_bias(x, b, new_nll, new_sm, new_am = crossentropy_softmax_argmax_1hot_with_bias(x, b,
one_of_n) one_of_n)
env.replace_all_validate([(nll, new_nll),(sm, new_sm)], reason="Merge") env.replace_all_validate([(nll, new_nll),(sm, new_sm)],
reason="crossentropy_to_crossentropy_with_softmax")
return True return True
return False return False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论