Commit 0ef36a5d authored by Yong Tang's avatar Yong Tang Committed by Rasmus Munk Larsen
Browse files

Add broadcast support for softmax_cross_entropy_with_logits (#16784)



* Add broadcast support for softmax_cross_entropy_with_logits

This fix tries to address the issue raised in 11534 where
there was no broadcast support for SoftmaxCrossEntropyWithLogits.
This fix adds the broadcast support for SoftmaxCrossEntropyWithLogits,
and adds test cases for it.

This fix fixes 11534.

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Add BroadcastBinaryOpOutputShapeFn for shape function

This commit adds BroadcastBinaryOpOutputShapeFn,
so that the implementation of BroadcastBinaryOpShapeFn
coule be reused in SoftmaxCrossEntropyWithLogits.

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Update the shape function of SoftmaxCrossEntropyWithLogits

so that broadcast could be supported.

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Add broadcast support for SoftmaxCrossEntropyWithLogits

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Add broadcast support for SoftmaxCrossEntropyWithLogits with GPU

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Reformat with clang-format

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Fix shape test issues

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Remove `_` for gen_nn_ops._softmax_cross_entropy_with_logits

as `_` is not needed anymore with the recent changes

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Sanitize nn_ops.cc with clang-format

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Add broadcast examples for SoftmaxCrossEntropyWithLogits shape function

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Add benchmark tests for trival cases

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>

* Fix pylint issue

Signed-off-by: default avatarYong Tang <yong.tang.github@outlook.com>
parent 5d76c7db
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment