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
1be49dc9
Commit
1be49dc9
authored
Oct 19, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug of last commit
parent
d2939cf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
tensorpack/train/simple.py
tensorpack/train/simple.py
+7
-3
No files found.
tensorpack/train/simple.py
View file @
1be49dc9
...
...
@@ -5,9 +5,9 @@
from
.base
import
Trainer
from
..tfutils.tower
import
TowerContext
from
..utils
import
logger
from
..input_source
import
FeedInput
,
QueueInput
from
..graph_builder.training
import
SimpleBuilder
__all__
=
[
'SimpleTrainer'
,
'QueueInputTrainer'
]
...
...
@@ -42,8 +42,12 @@ class SimpleTrainer(Trainer):
def
_setup
(
self
):
cbs
=
self
.
_input_source
.
setup
(
self
.
model
.
get_inputs_desc
())
self
.
train_op
=
SimpleBuilder
()
.
build
(
self
.
_input_source
,
self
.
model
.
build_graph_get_cost
,
self
.
model
.
get_optimizer
)
with
TowerContext
(
''
,
is_training
=
True
):
grads
=
self
.
model
.
build_graph_get_grads
(
*
self
.
_input_source
.
get_input_tensors
())
opt
=
self
.
model
.
get_optimizer
()
self
.
train_op
=
opt
.
apply_gradients
(
grads
,
name
=
'min_op'
)
self
.
_config
.
callbacks
.
extend
(
cbs
)
...
...
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