".github/git@developer.sourcefind.cn:wangsen/mineru.git" did not exist on "bcbbee8cbd32a84b46454bac04568ec94e3b33fd"
Commit e1a1328c authored by Mark Daoust's avatar Mark Daoust
Browse files

slice fix for 1.5

parent c08925ad
...@@ -66,7 +66,7 @@ feature_names = [ ...@@ -66,7 +66,7 @@ feature_names = [
def my_input_fn(file_path, repeat_count=1, shuffle_count=1): def my_input_fn(file_path, repeat_count=1, shuffle_count=1):
def decode_csv(line): def decode_csv(line):
parsed_line = tf.decode_csv(line, [[0.], [0.], [0.], [0.], [0]]) parsed_line = tf.decode_csv(line, [[0.], [0.], [0.], [0.], [0]])
label = parsed_line[-1:] # Last element is the label label = parsed_line[-1] # Last element is the label
del parsed_line[-1] # Delete last element del parsed_line[-1] # Delete last element
features = parsed_line # Everything but last elements are the features features = parsed_line # Everything but last elements are the features
d = dict(zip(feature_names, features)), label d = dict(zip(feature_names, features)), label
...@@ -136,9 +136,7 @@ def my_model_fn( ...@@ -136,9 +136,7 @@ def my_model_fn(
# Evaluation and Training mode # Evaluation and Training mode
# To calculate the loss, we need to convert our labels # Calculate the loss
# Our input labels have shape: [batch_size, 1]
labels = tf.squeeze(labels, 1) # Convert to shape [batch_size]
loss = tf.losses.sparse_softmax_cross_entropy(labels=labels, logits=logits) loss = tf.losses.sparse_softmax_cross_entropy(labels=labels, logits=logits)
# Calculate the accuracy between the true labels, and our predictions # Calculate the accuracy between the true labels, and our predictions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment