提交 3e05912e authored 作者: James Bergstra's avatar James Bergstra

Minor changes to complete implementation of…

Minor changes to complete implementation of local_advanced_indexing_crossentropy_onehot optimization
上级 dbd43e4d
...@@ -991,6 +991,11 @@ def local_advanced_indexing_crossentropy_onehot_grad(node): ...@@ -991,6 +991,11 @@ def local_advanced_indexing_crossentropy_onehot_grad(node):
# recognized too, but other variants, even with the same shape, might not # recognized too, but other variants, even with the same shape, might not
# (yet). # (yet).
#
# N.B. Regarding clients -- This substitution is important for numerical stability, so we
# perform the substitution even when intermediate values have multiple clients.
#
# First case. # First case.
# After the check for AdvancedIncSubtensor, if anything does not fit with # After the check for AdvancedIncSubtensor, if anything does not fit with
# the formula above, there's no way to fit it with the the second case, # the formula above, there's no way to fit it with the the second case,
...@@ -1105,7 +1110,7 @@ def local_advanced_indexing_crossentropy_onehot_grad(node): ...@@ -1105,7 +1110,7 @@ def local_advanced_indexing_crossentropy_onehot_grad(node):
return return
# Check that rows is arange(labels.shape[0]) # Check that rows is arange(labels.shape[0])
if not check_rows_is_arange_len_labels(rows, labels): if not _check_rows_is_arange_len_labels(rows, labels):
return return
# else, arguments of AdvancedIncSubtensor are OK # else, arguments of AdvancedIncSubtensor are OK
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论