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
05352860
Commit
05352860
authored
Jan 09, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc update and inputsdesc name check (#564)
parent
b936df1d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
12 deletions
+20
-12
.github/ISSUE_TEMPLATE.md
.github/ISSUE_TEMPLATE.md
+1
-1
docs/tutorial/symbolic.md
docs/tutorial/symbolic.md
+9
-4
tensorpack/graph_builder/model_desc.py
tensorpack/graph_builder/model_desc.py
+2
-0
tensorpack/tfutils/tower.py
tensorpack/tfutils/tower.py
+8
-7
No files found.
.github/ISSUE_TEMPLATE.md
View file @
05352860
Bug Reports/Feature Requests/Usage Questions Only:
Bug reports or other
problems with code: PLEASE always include
Any unexpected
problems with code: PLEASE always include
1.
What you did. (command you run and changes you made if using examples; post or describe your code if not)
2.
What you observed, e.g. as much as logs possible.
3.
What you expected, if not obvious.
...
...
docs/tutorial/symbolic.md
View file @
05352860
...
...
@@ -42,16 +42,21 @@ l = func(l, *args, **kwargs)
l = FullyConnected('fc1', l, 10, nl=tf.identity)
```
### Access
Internal Variables:
### Access
Relevant Tensors
Access the variables like this:
The variables inside the layer will be named
`name/W`
,
`name/b`
, etc.
See the API documentation of each layer for details.
When building the graph, you can access the variables like this:
```
python
l
=
Conv2D
(
'conv1'
,
l
,
32
,
3
)
print
(
l
.
variables
.
W
)
print
(
l
.
variables
.
b
)
```
The names are documented in API documentation.
Note that this method doesn't work with LinearWrap, and cannot access the variables created by an activation function.
But note that this is a hacky way and may not work with future versions of TensorFlow.
Also this method doesn't work with LinearWrap, and cannot access the variables created by an activation function.
The output of a layer is usually named
`name/output`
unless documented differently in the API.
You can always print a tensor to see its name.
### Use Models outside Tensorpack
...
...
tensorpack/graph_builder/model_desc.py
View file @
05352860
...
...
@@ -35,6 +35,8 @@ class InputDesc(
"""
shape
=
tuple
(
shape
)
# has to be tuple for "self" to be hashable
assert
isinstance
(
type
,
tf
.
DType
),
type
if
any
(
k
in
name
for
k
in
[
':'
,
'/'
,
' '
]):
raise
ValueError
(
"Invalid InputDesc name: '{}'"
.
format
(
name
))
self
=
super
(
InputDesc
,
cls
)
.
__new__
(
cls
,
type
,
shape
,
name
)
self
.
_cached_placeholder
=
None
return
self
...
...
tensorpack/tfutils/tower.py
View file @
05352860
...
...
@@ -170,12 +170,11 @@ def get_current_tower_context():
class
TowerFuncWrapper
(
object
):
"""
A wrapper around a
function which builds one tower (
one replicate of the model).
A wrapper around a
tower function (function which builds one tower, i.e.
one replicate of the model).
It keeps track of the name scope, variable scope and input/output tensors
each time the function is called.
:class:`TowerTrainer` needs this option to be set, so that
it knows how to build a predictor.
:class:`TowerTrainer` needs this so that it knows how to build a predictor.
"""
def
__init__
(
self
,
tower_fn
,
inputs_desc
):
...
...
@@ -186,7 +185,9 @@ class TowerFuncWrapper(object):
inputs_desc ([InputDesc]): use this to figure out the right name for the input tensors.
"""
assert
callable
(
tower_fn
),
tower_fn
if
not
isinstance
(
tower_fn
,
TowerFuncWrapper
):
inputs_desc_names
=
[
k
.
name
for
k
in
inputs_desc
]
assert
len
(
set
(
inputs_desc_names
))
==
len
(
inputs_desc_names
),
\
"Duplicated names in inputs_desc! "
+
str
(
inputs_desc_names
)
self
.
_tower_fn
=
tower_fn
self
.
_inputs_desc
=
inputs_desc
...
...
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