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
d53b5c4c
Commit
d53b5c4c
authored
Oct 19, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create the old-style trainer when requested
parent
4e644290
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
tensorpack/graph_builder/model_desc.py
tensorpack/graph_builder/model_desc.py
+1
-0
tensorpack/trainv2/base.py
tensorpack/trainv2/base.py
+10
-0
No files found.
tensorpack/graph_builder/model_desc.py
View file @
d53b5c4c
...
...
@@ -110,6 +110,7 @@ class ModelDescBase(object):
class
ModelDesc
(
ModelDescBase
):
"""
A ModelDesc with single cost and single optimizer.
It contains information about InputDesc, how to get cost, and how to get optimizer.
"""
def
get_cost
(
self
):
...
...
tensorpack/trainv2/base.py
View file @
d53b5c4c
...
...
@@ -21,6 +21,7 @@ from ..tfutils.tower import TowerFuncWrapper, get_current_tower_context
from
..tfutils.gradproc
import
FilterNoneGrad
from
..callbacks.steps
import
MaintainStepCounter
import
tensorpack.train
as
old_train
# noqa
from
..train.base
import
StopTraining
,
TrainLoop
__all__
=
[
'Trainer'
,
'SingleCostTrainer'
]
...
...
@@ -185,6 +186,15 @@ class Trainer(object):
self
.
initialize
(
session_creator
,
session_init
)
self
.
main_loop
(
steps_per_epoch
,
starting_epoch
,
max_epoch
)
# create the old trainer when called with TrainConfig
def
__new__
(
cls
,
*
args
,
**
kwargs
):
if
isinstance
(
args
[
0
],
old_train
.
TrainConfig
)
or
'config'
in
kwargs
:
name
=
cls
.
__name__
old_trainer
=
getattr
(
old_train
,
name
)
return
old_trainer
(
*
args
,
**
kwargs
)
else
:
return
super
(
Trainer
,
cls
)
.
__new__
(
cls
)
def
_get_property
(
name
):
"""
...
...
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