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
6a6d00cd
Commit
6a6d00cd
authored
Jan 22, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unittest in models/
parent
06643a86
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
3 deletions
+47
-3
README.md
README.md
+2
-1
example_mnist.py
example_mnist.py
+1
-1
tensorpack/dataflow/README.md
tensorpack/dataflow/README.md
+3
-1
tensorpack/models/_test.py
tensorpack/models/_test.py
+21
-0
tensorpack/models/pool.py
tensorpack/models/pool.py
+20
-0
No files found.
README.md
View file @
6a6d00cd
...
@@ -8,4 +8,5 @@ In development. No document, don't use.
...
@@ -8,4 +8,5 @@ In development. No document, don't use.
+
Provide callbacks to control training behavior (as in
[
Keras
](
http://keras.io
)
).
+
Provide callbacks to control training behavior (as in
[
Keras
](
http://keras.io
)
).
+
Use
`Dataflow`
to gain fine-grained control on data preprocessing.
+
Use
`Dataflow`
to gain fine-grained control on data preprocessing.
+
Automatically use the Queue operator in tensorflow to speed up input.
+
Automatically use the Queue operator in tensorflow to speed up input.
+
Training and testing graph are modeled together, automatically. Just need to follow the conventions to setup stuffs.
+
Training and testing graph are modeled together. Just need to follow the conventions to setup stuffs.
+
Use tensorboard easily.
example_mnist.py
View file @
6a6d00cd
...
@@ -25,7 +25,7 @@ CAPACITY = MIN_AFTER_DEQUEUE + 3 * BATCH_SIZE
...
@@ -25,7 +25,7 @@ CAPACITY = MIN_AFTER_DEQUEUE + 3 * BATCH_SIZE
def
get_model
(
inputs
,
is_training
):
def
get_model
(
inputs
,
is_training
):
"""
"""
Args:
Args:
inputs: a list of input variable
,
inputs: a list of input variable
for training
e.g.: [image_var, label_var] with:
e.g.: [image_var, label_var] with:
image_var: bx28x28
image_var: bx28x28
label_var: bx1 integer
label_var: bx1 integer
...
...
tensorpack/dataflow/README.md
View file @
6a6d00cd
## Dataflow
## Dataflow
Dataflow: use
`yield`
to build a efficient data processing pipeline.
Dataflow: use
`yield`
to build a
simple and
efficient data processing pipeline.
NOTE: Dataflow aims to be independent of tensorflow.
NOTE: Dataflow aims to be independent of tensorflow.
It should be useful for other python-based learning libraries.
It should be useful for other python-based learning libraries.
Documents to be done.
tensorpack/models/_test.py
0 → 100644
View file @
6a6d00cd
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: _test.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import
tensorflow
as
tf
import
numpy
as
np
from
.
import
*
import
unittest
subs
=
unittest
.
TestCase
.
__subclasses__
()
def
run_test_case
(
case
):
suite
=
unittest
.
TestLoader
()
.
loadTestsFromTestCase
(
case
)
unittest
.
TextTestRunner
(
verbosity
=
2
)
.
run
(
suite
)
for
cls
in
subs
:
if
'tensorpack.models'
in
str
(
cls
):
run_test_case
(
cls
)
tensorpack/models/pool.py
View file @
6a6d00cd
...
@@ -57,3 +57,23 @@ def FixedUnPooling(x, shape, unpool_mat=None):
...
@@ -57,3 +57,23 @@ def FixedUnPooling(x, shape, unpool_mat=None):
input_shape
[
2
]
*
shape
[
1
],
input_shape
[
2
]
*
shape
[
1
],
input_shape
[
3
]])
input_shape
[
3
]])
return
prod
return
prod
import
unittest
class
TestPool
(
unittest
.
TestCase
):
def
test_fixed_unpooling
(
self
):
h
,
w
=
3
,
4
mat
=
np
.
random
.
rand
(
h
,
w
)
.
astype
(
'float32'
)
inp
=
tf
.
Variable
(
mat
)
inp
=
tf
.
reshape
(
inp
,
[
1
,
h
,
w
,
1
])
output
=
FixedUnPooling
(
'unpool'
,
inp
,
2
)
sess
=
tf
.
Session
()
sess
.
run
(
tf
.
initialize_all_variables
())
res
=
sess
.
run
([
output
])[
0
]
self
.
assertEqual
(
res
.
shape
,
(
1
,
2
*
h
,
2
*
w
,
1
))
# mat is on cornser
ele
=
res
[
0
,::
2
,::
2
,
0
]
self
.
assertTrue
((
ele
==
mat
)
.
all
())
# the rest are zeros
res
[
0
,::
2
,::
2
,
0
]
=
0
self
.
assertTrue
((
res
==
0
)
.
all
())
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