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
b936df1d
You need to sign in or sign up before continuing.
Commit
b936df1d
authored
Jan 08, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
name scope improvements for StagingInput
parent
1d99dc4e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
14 deletions
+16
-14
examples/ResNet/imagenet-resnet.py
examples/ResNet/imagenet-resnet.py
+3
-3
tensorpack/input_source/input_source.py
tensorpack/input_source/input_source.py
+12
-10
tensorpack/input_source/input_source_base.py
tensorpack/input_source/input_source_base.py
+1
-1
No files found.
examples/ResNet/imagenet-resnet.py
View file @
b936df1d
...
...
@@ -10,7 +10,7 @@ from tensorpack import logger, QueueInput
from
tensorpack.models
import
*
from
tensorpack.callbacks
import
*
from
tensorpack.train
import
(
TrainConfig
,
SyncMultiGPUTrainer
ParameterServer
,
launch_train_with_config
)
TrainConfig
,
SyncMultiGPUTrainer
Replicated
,
launch_train_with_config
)
from
tensorpack.dataflow
import
FakeData
from
tensorpack.tfutils
import
argscope
,
get_model_loader
from
tensorpack.utils.gpu
import
get_nr_gpu
...
...
@@ -128,10 +128,10 @@ if __name__ == '__main__':
logger
.
set_logger_dir
(
os
.
path
.
join
(
'train_log'
,
'tmp'
),
'd'
)
else
:
logger
.
set_logger_dir
(
os
.
path
.
join
(
'train_log'
,
'imagenet-
resnet-d'
+
str
(
args
.
depth
)))
os
.
path
.
join
(
'train_log'
,
'imagenet-
{}-d{}'
.
format
(
args
.
mode
,
args
.
depth
)))
config
=
get_config
(
model
,
fake
=
args
.
fake
)
if
args
.
load
:
config
.
session_init
=
get_model_loader
(
args
.
load
)
trainer
=
SyncMultiGPUTrainer
ParameterServer
(
max
(
get_nr_gpu
(),
1
))
trainer
=
SyncMultiGPUTrainer
Replicated
(
max
(
get_nr_gpu
(),
1
))
launch_train_with_config
(
config
,
trainer
)
tensorpack/input_source/input_source.py
View file @
b936df1d
...
...
@@ -546,16 +546,18 @@ class StagingInput(FeedfreeInput):
# TODO tensorflow/benchmarks use static shapes here,
# though it doesn't seem to help. We can use it when it's known.
stage
=
StagingArea
(
dtypes
,
shapes
=
None
)
self
.
_stage_ops
.
append
(
stage
.
put
(
inputs
))
self
.
_areas
.
append
(
stage
)
outputs
=
stage
.
get
()
if
isinstance
(
outputs
,
tf
.
Tensor
):
# when size=1, TF doesn't return a list
outputs
=
[
outputs
]
for
vin
,
vout
in
zip
(
inputs
,
outputs
):
vout
.
set_shape
(
vin
.
get_shape
())
self
.
_unstage_ops
.
append
(
outputs
)
# self._size_ops.append(stage.size())
return
outputs
# put & get automatically inherit the name scope from the area
self
.
_stage_ops
.
append
(
stage
.
put
(
inputs
))
self
.
_areas
.
append
(
stage
)
outputs
=
stage
.
get
()
if
isinstance
(
outputs
,
tf
.
Tensor
):
# when size=1, TF doesn't return a list
outputs
=
[
outputs
]
for
vin
,
vout
in
zip
(
inputs
,
outputs
):
vout
.
set_shape
(
vin
.
get_shape
())
self
.
_unstage_ops
.
append
(
outputs
)
# self._size_ops.append(stage.size())
return
outputs
def
_get_stage_op
(
self
):
with
self
.
cached_name_scope
():
...
...
tensorpack/input_source/input_source_base.py
View file @
b936df1d
...
...
@@ -165,7 +165,7 @@ class InputSource(object):
with
tf
.
name_scope
(
self
.
_name_scope
):
yield
self
.
_name_scope
else
:
name
=
type
(
self
)
.
__name__
name
=
type
(
self
)
.
__name__
+
'/'
with
tf
.
name_scope
(
name
)
as
ns
:
self
.
_name_scope
=
ns
yield
ns
...
...
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