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
89b0c256
Commit
89b0c256
authored
May 06, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
also rename remap_get_variable.
parent
0774ec66
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
9 deletions
+19
-9
CHANGES.md
CHANGES.md
+4
-0
examples/DoReFa-Net/alexnet-dorefa.py
examples/DoReFa-Net/alexnet-dorefa.py
+2
-2
examples/DoReFa-Net/resnet-dorefa.py
examples/DoReFa-Net/resnet-dorefa.py
+2
-2
examples/DoReFa-Net/svhn-digit-dorefa.py
examples/DoReFa-Net/svhn-digit-dorefa.py
+2
-2
tensorpack/tfutils/varreplace.py
tensorpack/tfutils/varreplace.py
+9
-3
No files found.
CHANGES.md
View file @
89b0c256
...
...
@@ -8,6 +8,10 @@ so you won't need to look at here very often.
Here are a list of things that were changed, starting from an early version.
TensorFlow itself also changes API and those are not listed here.
+
[
2017/05/06
](
https://github.com/ppwwyyxx/tensorpack/commit/0774ec66e66075486f6a36aba63cc2a151b9fec8
)
.
`replace_get_variable`
was deprecated in favor of the official
`custom_getter`
interface.
`{freeze,remap}_get_variable`
was renamed to
`{freeze,remap}_variables`
.
+
[
2017/04/09
](
https://github.com/ppwwyyxx/tensorpack/commit/5beab907895aec36bdcaed62e25b976aad7979b8
)
.
`ParamRestore`
was renamed to
`DictRestore`
.
+
[
2017/03/16
](
https://github.com/ppwwyyxx/tensorpack/commit/ccae46f4a3ca89dc3df901a338eef8447d19a730
)
.
...
...
examples/DoReFa-Net/alexnet-dorefa.py
View file @
89b0c256
...
...
@@ -15,7 +15,7 @@ import sys
from
tensorpack
import
*
from
tensorpack.tfutils.symbolic_functions
import
*
from
tensorpack.tfutils.summary
import
*
from
tensorpack.tfutils.varreplace
import
remap_
get_variable
from
tensorpack.tfutils.varreplace
import
remap_
variables
from
dorefa
import
get_dorefa
"""
...
...
@@ -106,7 +106,7 @@ class Model(ModelDesc):
def
activate
(
x
):
return
fa
(
nonlin
(
x
))
with
remap_
get_variable
(
new_get_variable
),
\
with
remap_
variables
(
new_get_variable
),
\
argscope
(
BatchNorm
,
decay
=
0.9
,
epsilon
=
1e-4
),
\
argscope
([
Conv2D
,
FullyConnected
],
use_bias
=
False
,
nl
=
tf
.
identity
):
logits
=
(
LinearWrap
(
image
)
...
...
examples/DoReFa-Net/resnet-dorefa.py
View file @
89b0c256
...
...
@@ -13,7 +13,7 @@ from tensorpack import *
from
tensorpack.tfutils.symbolic_functions
import
*
from
tensorpack.tfutils.summary
import
*
from
tensorpack.utils.stats
import
RatioCounter
from
tensorpack.tfutils.varreplace
import
remap_
get_variable
from
tensorpack.tfutils.varreplace
import
remap_
variables
from
dorefa
import
get_dorefa
"""
...
...
@@ -90,7 +90,7 @@ class Model(ModelDesc):
x
=
resblock
(
x
,
channel
,
1
)
return
x
with
remap_
get_variable
(
new_get_variable
),
\
with
remap_
variables
(
new_get_variable
),
\
argscope
(
BatchNorm
,
decay
=
0.9
,
epsilon
=
1e-4
),
\
argscope
(
Conv2D
,
use_bias
=
False
,
nl
=
tf
.
identity
):
logits
=
(
LinearWrap
(
image
)
...
...
examples/DoReFa-Net/svhn-digit-dorefa.py
View file @
89b0c256
...
...
@@ -10,7 +10,7 @@ import os
from
tensorpack
import
*
from
tensorpack.tfutils.symbolic_functions
import
*
from
tensorpack.tfutils.summary
import
*
from
tensorpack.tfutils.varreplace
import
remap_
get_variable
from
tensorpack.tfutils.varreplace
import
remap_
variables
import
tensorflow
as
tf
from
dorefa
import
get_dorefa
...
...
@@ -74,7 +74,7 @@ class Model(ModelDesc):
image
=
image
/
256.0
with
remap_
get_variable
(
binarize_weight
),
\
with
remap_
variables
(
binarize_weight
),
\
argscope
(
BatchNorm
,
decay
=
0.9
,
epsilon
=
1e-4
),
\
argscope
(
Conv2D
,
use_bias
=
False
,
nl
=
tf
.
identity
):
logits
=
(
LinearWrap
(
image
)
...
...
tensorpack/tfutils/varreplace.py
View file @
89b0c256
...
...
@@ -9,7 +9,8 @@ from contextlib import contextmanager
from
..utils.develop
import
deprecated
__all__
=
[
'custom_getter_scope'
,
'replace_get_variable'
,
'freeze_variables'
,
'freeze_get_variable'
,
'remap_get_variable'
]
'freeze_variables'
,
'freeze_get_variable'
,
'remap_get_variable'
,
'remap_variables'
]
@
contextmanager
...
...
@@ -32,7 +33,7 @@ def replace_get_variable(fn):
return
custom_getter_scope
(
getter
)
def
remap_
get_variable
(
fn
):
def
remap_
variables
(
fn
):
"""
Use fn to map the output of any variable getter.
...
...
@@ -61,7 +62,12 @@ def freeze_variables():
with varreplace.freeze_get_variable():
x = FullyConnected('fc', x, 1000) # fc/* will not be trained
"""
return
remap_get_variable
(
lambda
v
:
tf
.
stop_gradient
(
v
))
return
remap_variables
(
lambda
v
:
tf
.
stop_gradient
(
v
))
@
deprecated
(
"Renamed to remap_variables"
,
"2017-11-06"
)
def
remap_get_variable
():
return
remap_variables
()
@
deprecated
(
"Renamed to freeze_variables"
,
"2017-11-06"
)
...
...
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