-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
shenweichen
committed
Oct 9, 2017
1 parent
e704c5a
commit 977ec7c
Showing
5 changed files
with
115 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import tensorflow as tf | ||
def sigmoid_cross_entropy_with_probs(labels=None,probs=None,name=None): | ||
try: | ||
labels.get_shape().merge_with(probs.get_shape()) | ||
except ValueError: | ||
raise ValueError("logits and labels must have the same shape (%s vs %s)" % | ||
(logits.get_shape(), labels.get_shape())) | ||
return -tf.reduce_sum(labels * tf.log(probs,)+(1-labels)*tf.log(1-probs), name=name) |