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
2b41edf7
Commit
2b41edf7
authored
Oct 29, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
897d29e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
tensorpack/callbacks/base.py
tensorpack/callbacks/base.py
+3
-2
No files found.
tensorpack/callbacks/base.py
View file @
2b41edf7
...
@@ -7,7 +7,6 @@ from abc import ABCMeta
...
@@ -7,7 +7,6 @@ from abc import ABCMeta
import
six
import
six
from
..utils.develop
import
log_deprecated
from
..utils.develop
import
log_deprecated
from
..tfutils.common
import
get_op_or_tensor_by_name
from
..tfutils.common
import
get_op_or_tensor_by_name
from
..train.tower
import
TowerTrainer
__all__
=
[
'Callback'
,
'ProxyCallback'
,
'CallbackFactory'
]
__all__
=
[
'Callback'
,
'ProxyCallback'
,
'CallbackFactory'
]
...
@@ -212,6 +211,8 @@ class Callback(object):
...
@@ -212,6 +211,8 @@ class Callback(object):
Will automatically check for the __first training tower__
Will automatically check for the __first training tower__
if no tensor with the given name exists.
if no tensor with the given name exists.
"""
"""
from
..train.tower
import
TowerTrainer
# noqa
def
get_tensor
(
name
):
def
get_tensor
(
name
):
msg
=
"Tensor {} not found in the graph!"
.
format
(
name
)
msg
=
"Tensor {} not found in the graph!"
.
format
(
name
)
try
:
try
:
...
@@ -221,7 +222,7 @@ class Callback(object):
...
@@ -221,7 +222,7 @@ class Callback(object):
assert
isinstance
(
self
.
trainer
,
TowerTrainer
),
msg
assert
isinstance
(
self
.
trainer
,
TowerTrainer
),
msg
towers
=
self
.
trainer
.
tower_func
.
towers
towers
=
self
.
trainer
.
tower_func
.
towers
try
:
try
:
return
towers
.
training
()[
name
]
return
towers
.
training
()[
0
][
name
]
except
KeyError
:
except
KeyError
:
raise
KeyError
(
msg
)
raise
KeyError
(
msg
)
return
[
get_tensor
(
name
)
for
name
in
names
]
return
[
get_tensor
(
name
)
for
name
in
names
]
...
...
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