Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
5854c7de
You need to sign in or sign up before continuing.
Commit
5854c7de
authored
Jul 03, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc small fixes for old TF version (#810)
parent
2a712afe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
5 deletions
+10
-5
tensorpack/dataflow/dataset/ilsvrc.py
tensorpack/dataflow/dataset/ilsvrc.py
+1
-1
tensorpack/input_source/input_source.py
tensorpack/input_source/input_source.py
+1
-1
tensorpack/models/batch_norm.py
tensorpack/models/batch_norm.py
+1
-1
tensorpack/utils/fs.py
tensorpack/utils/fs.py
+7
-2
No files found.
tensorpack/dataflow/dataset/ilsvrc.py
View file @
5854c7de
...
@@ -53,7 +53,7 @@ class ILSVRCMeta(object):
...
@@ -53,7 +53,7 @@ class ILSVRCMeta(object):
return
dict
(
enumerate
(
lines
))
return
dict
(
enumerate
(
lines
))
def
_download_caffe_meta
(
self
):
def
_download_caffe_meta
(
self
):
fpath
=
download
(
CAFFE_ILSVRC12_URL
,
self
.
dir
)
fpath
=
download
(
CAFFE_ILSVRC12_URL
,
self
.
dir
,
expect_size
=
17858008
)
tarfile
.
open
(
fpath
,
'r:gz'
)
.
extractall
(
self
.
dir
)
tarfile
.
open
(
fpath
,
'r:gz'
)
.
extractall
(
self
.
dir
)
def
get_image_list
(
self
,
name
,
dir_structure
=
'original'
):
def
get_image_list
(
self
,
name
,
dir_structure
=
'original'
):
...
...
tensorpack/input_source/input_source.py
View file @
5854c7de
...
@@ -504,7 +504,7 @@ class StagingInput(FeedfreeInput):
...
@@ -504,7 +504,7 @@ class StagingInput(FeedfreeInput):
def
_setup_graph
(
self
):
def
_setup_graph
(
self
):
self
.
stage_op
=
self
.
_input
.
_get_stage_op
()
self
.
stage_op
=
self
.
_input
.
_get_stage_op
()
unstage_ops
=
self
.
_input
.
_get_unstage_ops
()
unstage_ops
=
self
.
_input
.
_get_unstage_ops
()
unstage_op
=
tf
.
group
(
unstage_ops
,
name
=
'unstage_all'
)
unstage_op
=
tf
.
group
(
*
unstage_ops
,
name
=
'unstage_all'
)
self
.
_check_dependency_op
=
unstage_ops
[
0
]
self
.
_check_dependency_op
=
unstage_ops
[
0
]
self
.
fetches
=
tf
.
train
.
SessionRunArgs
(
self
.
fetches
=
tf
.
train
.
SessionRunArgs
(
fetches
=
[
self
.
stage_op
,
unstage_op
])
fetches
=
[
self
.
stage_op
,
unstage_op
])
...
...
tensorpack/models/batch_norm.py
View file @
5854c7de
...
@@ -166,7 +166,7 @@ def BatchNorm(inputs, axis=None, training=None, momentum=0.9, epsilon=1e-5,
...
@@ -166,7 +166,7 @@ def BatchNorm(inputs, axis=None, training=None, momentum=0.9, epsilon=1e-5,
center
=
center
,
scale
=
scale
,
center
=
center
,
scale
=
scale
,
beta_initializer
=
beta_initializer
,
beta_initializer
=
beta_initializer
,
gamma_initializer
=
gamma_initializer
,
gamma_initializer
=
gamma_initializer
,
fused
=
True
,
fused
=
(
ndims
==
4
and
axis
in
[
1
,
3
])
,
_reuse
=
tf
.
get_variable_scope
()
.
reuse
)
_reuse
=
tf
.
get_variable_scope
()
.
reuse
)
if
TF_version
>=
1.5
:
if
TF_version
>=
1.5
:
tf_args
[
'virtual_batch_size'
]
=
virtual_batch_size
tf_args
[
'virtual_batch_size'
]
=
virtual_batch_size
...
...
tensorpack/utils/fs.py
View file @
5854c7de
...
@@ -28,7 +28,7 @@ def mkdir_p(dirname):
...
@@ -28,7 +28,7 @@ def mkdir_p(dirname):
raise
e
raise
e
def
download
(
url
,
dir
,
filename
=
None
):
def
download
(
url
,
dir
,
filename
=
None
,
expect_size
=
None
):
"""
"""
Download URL to a directory.
Download URL to a directory.
Will figure out the filename automatically from URL, if not given.
Will figure out the filename automatically from URL, if not given.
...
@@ -55,7 +55,12 @@ def download(url, dir, filename=None):
...
@@ -55,7 +55,12 @@ def download(url, dir, filename=None):
except
IOError
:
except
IOError
:
logger
.
error
(
"Failed to download {}"
.
format
(
url
))
logger
.
error
(
"Failed to download {}"
.
format
(
url
))
raise
raise
assert
size
>
0
,
"Download an empty file!"
assert
size
>
0
,
"Downloaded an empty file from {}!"
.
format
(
url
)
if
expect_size
is
not
None
and
size
!=
expect_size
:
logger
.
error
(
"File downloaded from {} does not match the expected size!"
.
format
(
url
))
logger
.
error
(
"You may have downloaded a broken file, or the upstream may have modified the file."
)
# TODO human-readable size
# TODO human-readable size
print
(
'Succesfully downloaded '
+
filename
+
". "
+
str
(
size
)
+
' bytes.'
)
print
(
'Succesfully downloaded '
+
filename
+
". "
+
str
(
size
)
+
' bytes.'
)
return
fpath
return
fpath
...
...
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