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
c45213c9
Commit
c45213c9
authored
Dec 17, 2018
by
jianchao-li
Committed by
Mark Daoust
Jul 30, 2019
Browse files
Use distutils.version.StrictVersion for version comparisons
parent
a989673b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
samples/outreach/blogs/blog_custom_estimators.py
samples/outreach/blogs/blog_custom_estimators.py
+3
-1
samples/outreach/blogs/blog_estimators_dataset.py
samples/outreach/blogs/blog_estimators_dataset.py
+3
-1
tutorials/rnn/ptb/ptb_word_lm.py
tutorials/rnn/ptb/ptb_word_lm.py
+4
-2
No files found.
samples/outreach/blogs/blog_custom_estimators.py
View file @
c45213c9
...
...
@@ -22,12 +22,14 @@ import sys
import
six.moves.urllib.request
as
request
from
distutils.version
import
StrictVersion
tf
.
logging
.
set_verbosity
(
tf
.
logging
.
INFO
)
# Check that we have correct TensorFlow version installed
tf_version
=
tf
.
__version__
tf
.
logging
.
info
(
"TensorFlow version: {}"
.
format
(
tf_version
))
assert
"1.4"
<=
tf_version
,
"TensorFlow r1.4 or later is needed"
assert
StrictVersion
(
"1.4"
)
<=
StrictVersion
(
tf_version
)
,
"TensorFlow r1.4 or later is needed"
# Windows users: You only need to change PATH, rest is platform independent
PATH
=
"/tmp/tf_custom_estimators"
...
...
samples/outreach/blogs/blog_estimators_dataset.py
View file @
c45213c9
...
...
@@ -22,10 +22,12 @@ import os
import
six.moves.urllib.request
as
request
import
tensorflow
as
tf
from
distutils.version
import
StrictVersion
# Check that we have correct TensorFlow version installed
tf_version
=
tf
.
__version__
print
(
"TensorFlow version: {}"
.
format
(
tf_version
))
assert
"1.4"
<=
tf_version
,
"TensorFlow r1.4 or later is needed"
assert
StrictVersion
(
"1.4"
)
<=
StrictVersion
(
tf_version
)
,
"TensorFlow r1.4 or later is needed"
# Windows users: You only need to change PATH, rest is platform independent
PATH
=
"/tmp/tf_dataset_and_estimator_apis"
...
...
tutorials/rnn/ptb/ptb_word_lm.py
View file @
c45213c9
...
...
@@ -69,6 +69,8 @@ import util
from
tensorflow.python.client
import
device_lib
from
distutils.version
import
StrictVersion
flags
=
tf
.
flags
logging
=
tf
.
logging
...
...
@@ -436,7 +438,7 @@ def get_config():
raise
ValueError
(
"Invalid model: %s"
,
FLAGS
.
model
)
if
FLAGS
.
rnn_mode
:
config
.
rnn_mode
=
FLAGS
.
rnn_mode
if
FLAGS
.
num_gpus
!=
1
or
tf
.
__version__
<
"1.3.0"
:
if
FLAGS
.
num_gpus
!=
1
or
StrictVersion
(
tf
.
__version__
)
<
StrictVersion
(
"1.3.0"
)
:
config
.
rnn_mode
=
BASIC
return
config
...
...
@@ -489,7 +491,7 @@ def main(_):
for
name
,
model
in
models
.
items
():
model
.
export_ops
(
name
)
metagraph
=
tf
.
train
.
export_meta_graph
()
if
tf
.
__version__
<
"1.1.0"
and
FLAGS
.
num_gpus
>
1
:
if
StrictVersion
(
tf
.
__version__
)
<
StrictVersion
(
"1.1.0"
)
and
FLAGS
.
num_gpus
>
1
:
raise
ValueError
(
"num_gpus > 1 is not supported for TensorFlow versions "
"below 1.1.0"
)
soft_placement
=
False
...
...
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