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
92748c90
Commit
92748c90
authored
Jul 17, 2019
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc cleanups
parent
999846b2
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
12 additions
and
433 deletions
+12
-433
docs/casestudies/colorize.md
docs/casestudies/colorize.md
+0
-406
docs/casestudies/index.rst
docs/casestudies/index.rst
+0
-8
docs/conf.py
docs/conf.py
+1
-1
examples/DynamicFilterNetwork/steering-filter.py
examples/DynamicFilterNetwork/steering-filter.py
+1
-1
tensorpack/models/registry.py
tensorpack/models/registry.py
+3
-3
tensorpack/tfutils/__init__.py
tensorpack/tfutils/__init__.py
+3
-3
tensorpack/tfutils/argscope.py
tensorpack/tfutils/argscope.py
+2
-9
tensorpack/tfutils/model_utils.py
tensorpack/tfutils/model_utils.py
+2
-2
No files found.
docs/casestudies/colorize.md
deleted
100644 → 0
View file @
999846b2
This diff is collapsed.
Click to expand it.
docs/casestudies/index.rst
deleted
100644 → 0
View file @
999846b2
Casestudies
--------------------
.. toctree::
:maxdepth: 1
colorize
docs/conf.py
View file @
92748c90
...
@@ -359,7 +359,7 @@ def process_signature(app, what, name, obj, options, signature,
...
@@ -359,7 +359,7 @@ def process_signature(app, what, name, obj, options, signature,
signature
=
re
.
sub
(
'tensorflow'
,
'tf'
,
signature
)
signature
=
re
.
sub
(
'tensorflow'
,
'tf'
,
signature
)
# add scope name to layer signatures:
# add scope name to layer signatures:
if
hasattr
(
obj
,
'use_scope'
)
and
hasattr
(
obj
,
'symbolic_function'
)
:
if
hasattr
(
obj
,
'use_scope'
):
if
obj
.
use_scope
:
if
obj
.
use_scope
:
signature
=
signature
[
0
]
+
'variable_scope_name, '
+
signature
[
1
:]
signature
=
signature
[
0
]
+
'variable_scope_name, '
+
signature
[
1
:]
elif
obj
.
use_scope
is
None
:
elif
obj
.
use_scope
is
None
:
...
...
examples/DynamicFilterNetwork/steering-filter.py
View file @
92748c90
...
@@ -88,7 +88,7 @@ class OnlineTensorboardExport(Callback):
...
@@ -88,7 +88,7 @@ class OnlineTensorboardExport(Callback):
canvas
=
cv2
.
resize
(
canvas
[
...
,
None
]
*
255
,
(
0
,
0
),
fx
=
10
,
fy
=
10
)
canvas
=
cv2
.
resize
(
canvas
[
...
,
None
]
*
255
,
(
0
,
0
),
fx
=
10
,
fy
=
10
)
self
.
trainer
.
monitors
.
put_image
(
'filter_export'
,
canvas
)
self
.
trainer
.
monitors
.
put_image
(
'filter_export'
,
canvas
)
# # you might also want to write these images to disk
(as in the casestudy from the docs)
# # you might also want to write these images to disk
# cv2.imwrite("export/out%04i.jpg" % self.cc, canvas)
# cv2.imwrite("export/out%04i.jpg" % self.cc, canvas)
# self.cc += 1
# self.cc += 1
...
...
tensorpack/models/registry.py
View file @
92748c90
...
@@ -103,8 +103,8 @@ def layer_register(
...
@@ -103,8 +103,8 @@ def layer_register(
if
use_scope
is
False
:
if
use_scope
is
False
:
logger
.
warn
(
logger
.
warn
(
"Please call layer {} without the first scope name argument, "
"Please call layer {} without the first scope name argument, "
"or register the layer with use_scope=None to allow "
"or register the layer with use_scope=None to allow
calling it
"
"
two calling method
s."
.
format
(
func
.
__name__
))
"
with scope name
s."
.
format
(
func
.
__name__
))
name
,
inputs
=
args
[
0
],
args
[
1
]
name
,
inputs
=
args
[
0
],
args
[
1
]
args
=
args
[
1
:]
# actual positional args used to call func
args
=
args
[
1
:]
# actual positional args used to call func
else
:
else
:
...
@@ -147,8 +147,8 @@ def layer_register(
...
@@ -147,8 +147,8 @@ def layer_register(
outputs
=
func
(
*
args
,
**
actual_args
)
outputs
=
func
(
*
args
,
**
actual_args
)
return
outputs
return
outputs
wrapped_func
.
symbolic_function
=
func
# attribute to access the underlying function object
wrapped_func
.
use_scope
=
use_scope
wrapped_func
.
use_scope
=
use_scope
wrapped_func
.
__argscope_enabled__
=
True
_register
(
func
.
__name__
,
wrapped_func
)
_register
(
func
.
__name__
,
wrapped_func
)
return
wrapped_func
return
wrapped_func
...
...
tensorpack/tfutils/__init__.py
View file @
92748c90
...
@@ -42,8 +42,8 @@ so that these names will be invisible under `tensorpack.` namespace.
...
@@ -42,8 +42,8 @@ so that these names will be invisible under `tensorpack.` namespace.
To use these utilities, users are expected to import them explicitly, e.g.:
To use these utilities, users are expected to import them explicitly, e.g.:
import tensorpack.tfutils.s
ymbolic_functions as symbf
import tensorpack.tfutils.s
essinit as sessinit
"""
"""
__all__
.
extend
([
'sessinit'
,
'summary'
,
'optimizer'
,
__all__
.
extend
([
'sessinit'
,
'summary'
,
'optimizer'
,
'sesscreate'
,
'gradproc'
,
'varreplace'
,
'symbolic_functions'
,
'sesscreate'
,
'gradproc'
,
'varreplace'
,
'
distributed'
,
'
tower'
])
'tower'
])
tensorpack/tfutils/argscope.py
View file @
92748c90
...
@@ -40,14 +40,8 @@ def argscope(layers, **kwargs):
...
@@ -40,14 +40,8 @@ def argscope(layers, **kwargs):
if
not
isinstance
(
layers
,
list
):
if
not
isinstance
(
layers
,
list
):
layers
=
[
layers
]
layers
=
[
layers
]
# def _check_args_exist(l):
# args = inspect.getargspec(l).args
# for k, v in six.iteritems(kwargs):
# assert k in args, "No argument {} in {}".format(k, l.__name__)
for
l
in
layers
:
for
l
in
layers
:
assert
hasattr
(
l
,
'symbolic_function'
),
"{} is not a registered layer"
.
format
(
l
.
__name__
)
assert
hasattr
(
l
,
'__argscope_enabled__'
),
"Argscope not supported for {}"
.
format
(
l
)
# _check_args_exist(l.symbolic_function)
# need to deepcopy so that changes to new_scope does not affect outer scope
# need to deepcopy so that changes to new_scope does not affect outer scope
new_scope
=
copy
.
deepcopy
(
get_arg_scope
())
new_scope
=
copy
.
deepcopy
(
get_arg_scope
())
...
@@ -119,8 +113,7 @@ def enable_argscope_for_function(func, log_shape=True):
...
@@ -119,8 +113,7 @@ def enable_argscope_for_function(func, log_shape=True):
out_tensor_descr
.
shape
.
as_list
()))
out_tensor_descr
.
shape
.
as_list
()))
return
out_tensor
return
out_tensor
# argscope requires this property
wrapped_func
.
__argscope_enabled__
=
True
wrapped_func
.
symbolic_function
=
None
return
wrapped_func
return
wrapped_func
...
...
tensorpack/tfutils/model_utils.py
View file @
92748c90
...
@@ -6,12 +6,12 @@ from ..compat import tfv1 as tf
...
@@ -6,12 +6,12 @@ from ..compat import tfv1 as tf
from
tabulate
import
tabulate
from
tabulate
import
tabulate
from
termcolor
import
colored
from
termcolor
import
colored
from
.common
import
get_op_tensor_name
from
..utils
import
logger
from
..utils
import
logger
__all__
=
[]
__all__
=
[]
# TODO should also describe model_variables
def
describe_trainable_vars
():
def
describe_trainable_vars
():
"""
"""
Print a description of the current model parameters.
Print a description of the current model parameters.
...
@@ -39,7 +39,7 @@ def describe_trainable_vars():
...
@@ -39,7 +39,7 @@ def describe_trainable_vars():
total
+=
ele
total
+=
ele
total_bytes
+=
ele
*
v
.
dtype
.
size
total_bytes
+=
ele
*
v
.
dtype
.
size
data
.
append
([
v
.
name
,
shape
,
ele
,
v
.
device
,
v
.
dtype
.
base_dtype
.
name
])
data
.
append
([
get_op_tensor_name
(
v
.
name
)[
0
]
,
shape
,
ele
,
v
.
device
,
v
.
dtype
.
base_dtype
.
name
])
headers
=
[
'name'
,
'shape'
,
'#elements'
,
'device'
,
'dtype'
]
headers
=
[
'name'
,
'shape'
,
'#elements'
,
'device'
,
'dtype'
]
dtypes
=
list
(
set
([
x
[
4
]
for
x
in
data
]))
dtypes
=
list
(
set
([
x
[
4
]
for
x
in
data
]))
...
...
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