Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatibility with tensorflow 1.0+. Fixes #19. #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ def get_loss(y, y_):
# Calculate the loss from digits being incorrect. Don't count loss from
# digits that are in non-present plates.
digits_loss = tf.nn.softmax_cross_entropy_with_logits(
tf.reshape(y[:, 1:],
logits=tf.reshape(y[:, 1:],
[-1, len(common.CHARS)]),
tf.reshape(y_[:, 1:],
labels=tf.reshape(y_[:, 1:],
[-1, len(common.CHARS)]))
digits_loss = tf.reshape(digits_loss, [-1, 7])
digits_loss = tf.reduce_sum(digits_loss, 1)
Expand All @@ -137,7 +137,7 @@ def get_loss(y, y_):

# Calculate the loss from presence indicator being wrong.
presence_loss = tf.nn.sigmoid_cross_entropy_with_logits(
y[:, :1], y_[:, :1])
logits=y[:, :1], labels=y_[:, :1])
presence_loss = 7 * tf.reduce_sum(presence_loss)

return digits_loss, presence_loss, digits_loss + presence_loss
Expand Down