Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
e1a1328c
Commit
e1a1328c
authored
Dec 19, 2017
by
Mark Daoust
Browse files
slice fix for 1.5
parent
c08925ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
samples/outreach/blogs/Blog_Custom_Estimators.py
samples/outreach/blogs/Blog_Custom_Estimators.py
+2
-4
No files found.
samples/outreach/blogs/Blog_Custom_Estimators.py
View file @
e1a1328c
...
...
@@ -66,7 +66,7 @@ feature_names = [
def
my_input_fn
(
file_path
,
repeat_count
=
1
,
shuffle_count
=
1
):
def
decode_csv
(
line
):
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
features
=
parsed_line
# Everything but last elements are the features
d
=
dict
(
zip
(
feature_names
,
features
)),
label
...
...
@@ -136,9 +136,7 @@ def my_model_fn(
# Evaluation and Training mode
# To calculate the loss, we need to convert our labels
# Our input labels have shape: [batch_size, 1]
labels
=
tf
.
squeeze
(
labels
,
1
)
# Convert to shape [batch_size]
# Calculate the loss
loss
=
tf
.
losses
.
sparse_softmax_cross_entropy
(
labels
=
labels
,
logits
=
logits
)
# Calculate the accuracy between the true labels, and our predictions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment