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
871025d6
Commit
871025d6
authored
Apr 16, 2019
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
argscope tutorial with more argscope(fix #1147)
parent
520a12d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
docs/tutorial/symbolic.md
docs/tutorial/symbolic.md
+6
-0
tensorpack/tfutils/sesscreate.py
tensorpack/tfutils/sesscreate.py
+4
-0
No files found.
docs/tutorial/symbolic.md
View file @
871025d6
...
...
@@ -37,6 +37,9 @@ with argscope(Conv2D, filters=32, kernel_size=3, activation=tf.nn.relu):
.
tf
.
multiply
(
0.5
)
.
apply
(
func
,
*
args
,
**
kwargs
)
.
FullyConnected
(
'fc1'
,
units
=
10
,
activation
=
tf
.
identity
)())
with
argscope
([
Conv2D
,
MaxPooling
],
data_format
=
'NCHW'
),
argscope
(
Conv2D
,
kernel_size
=
1
):
l2
=
LinearWrap
(
image
)
.
Conv2D
(
'conv3'
,
strides
=
2
)
.
MaxPooling
(
'pool3'
,
2
)
```
is equivalent to:
```
...
...
@@ -49,6 +52,9 @@ l = Dropout('dropout', l, rate=0.5)
l = tf.multiply(l, 0.5)
l = func(l, *args, **kwargs)
l = FullyConnected('fc1', l, 10, activation=tf.identity)
l2 = Conv2D('conv3', image, 32, 1, strides=2, data_format='NCHW', activation=tf.nn.relu)
l2 = MaxPooling('pool3', l2, 2, data_format='NCHW')
```
If you need to access the output of some layer and use it with some other
...
...
tensorpack/tfutils/sesscreate.py
View file @
871025d6
...
...
@@ -92,6 +92,10 @@ class ReuseSessionCreator(tf.train.SessionCreator):
class
SessionCreatorAdapter
(
tf
.
train
.
SessionCreator
):
"""
Apply a function on the output of a SessionCreator. Can be used to create a debug session.
Note:
Since TF 1.6, debug session may not work properly with Monitored session.
This is a tensorflow bug. To use tfdbg, use the :class:`TFLocalCLIDebugHook` callback instead.
"""
def
__init__
(
self
,
session_creator
,
func
):
"""
...
...
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