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
f7e35411
Commit
f7e35411
authored
Sep 18, 2019
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests; remove nightly from CI
parent
6e93970f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
.github/workflows/workflow.yml
.github/workflows/workflow.yml
+2
-1
tensorpack/models/models_test.py
tensorpack/models/models_test.py
+24
-7
No files found.
.github/workflows/workflow.yml
View file @
f7e35411
...
@@ -36,7 +36,8 @@ jobs:
...
@@ -36,7 +36,8 @@ jobs:
max-parallel
:
6
max-parallel
:
6
matrix
:
matrix
:
python-version
:
[
3.6
]
python-version
:
[
3.6
]
TF-version
:
[
1.3.0
,
1.14.0
,
nightly
]
# TF-version: [1.3.0, 1.14.0, nightly] # TODO make nightly work
TF-version
:
[
1.3.0
,
1.14.0
]
steps
:
steps
:
-
uses
:
actions/checkout@v1
-
uses
:
actions/checkout@v1
-
name
:
Set up Python ${{ matrix.python-version }}
-
name
:
Set up Python ${{ matrix.python-version }}
...
...
tensorpack/models/models_test.py
View file @
f7e35411
...
@@ -13,13 +13,13 @@ from .pool import FixedUnPooling
...
@@ -13,13 +13,13 @@ from .pool import FixedUnPooling
class
TestModel
(
unittest
.
TestCase
):
class
TestModel
(
unittest
.
TestCase
):
def
run_variable
(
self
,
var
):
def
eval
(
self
,
x
,
feed_dict
=
None
):
sess
=
tf
.
Session
()
sess
=
tf
.
Session
()
sess
.
run
(
tf
.
global_variables_initializer
())
sess
.
run
(
tf
.
global_variables_initializer
())
if
isinstance
(
var
,
list
):
if
isinstance
(
x
,
list
):
return
sess
.
run
(
var
)
return
sess
.
run
(
x
,
feed_dict
=
feed_dict
)
else
:
else
:
return
sess
.
run
([
var
]
)[
0
]
return
sess
.
run
([
x
],
feed_dict
=
feed_dict
)[
0
]
def
make_variable
(
self
,
*
args
):
def
make_variable
(
self
,
*
args
):
if
len
(
args
)
>
1
:
if
len
(
args
)
>
1
:
...
@@ -36,7 +36,7 @@ class TestPool(TestModel):
...
@@ -36,7 +36,7 @@ class TestPool(TestModel):
input
=
self
.
make_variable
(
mat
)
input
=
self
.
make_variable
(
mat
)
input
=
tf
.
reshape
(
input
,
[
1
,
h
,
w
,
3
])
input
=
tf
.
reshape
(
input
,
[
1
,
h
,
w
,
3
])
output
=
FixedUnPooling
(
'unpool'
,
input
,
scale
)
output
=
FixedUnPooling
(
'unpool'
,
input
,
scale
)
res
=
self
.
run_variable
(
output
)
res
=
self
.
eval
(
output
)
self
.
assertEqual
(
res
.
shape
,
(
1
,
scale
*
h
,
scale
*
w
,
3
))
self
.
assertEqual
(
res
.
shape
,
(
1
,
scale
*
h
,
scale
*
w
,
3
))
# mat is on corner
# mat is on corner
...
@@ -56,7 +56,7 @@ class TestPool(TestModel):
...
@@ -56,7 +56,7 @@ class TestPool(TestModel):
# inp = tf.reshape(inp, [1, h, w, 1])
# inp = tf.reshape(inp, [1, h, w, 1])
#
#
# output = BilinearUpSample(inp, scale)
# output = BilinearUpSample(inp, scale)
# res = self.
run_variable
(output)[0, :, :, 0]
# res = self.
eval
(output)[0, :, :, 0]
#
#
# from skimage.transform import rescale
# from skimage.transform import rescale
# res2 = rescale(mat, scale, mode='edge')
# res2 = rescale(mat, scale, mode='edge')
...
@@ -83,9 +83,26 @@ class TestConv2DTranspose(TestModel):
...
@@ -83,9 +83,26 @@ class TestConv2DTranspose(TestModel):
input
,
20
,
3
,
strides
=
stride
,
padding
=
padding
)
input
,
20
,
3
,
strides
=
stride
,
padding
=
padding
)
static_shape
=
output
.
shape
static_shape
=
output
.
shape
dynamic_shape
=
self
.
run_variable
(
output
)
.
shape
dynamic_shape
=
self
.
eval
(
output
)
.
shape
self
.
assertTrue
(
static_shape
==
dynamic_shape
)
self
.
assertTrue
(
static_shape
==
dynamic_shape
)
def
test_unspecified_shape_match
(
self
):
h
,
w
=
12
,
18
input
=
tf
.
placeholder
(
shape
=
(
1
,
h
,
None
,
3
),
dtype
=
tf
.
float32
)
for
padding
in
[
"same"
,
"valid"
]:
for
stride
in
[
1
,
2
]:
output
=
Conv2DTranspose
(
'deconv_s{}_pad{}'
.
format
(
stride
,
padding
),
input
,
20
,
3
,
strides
=
stride
,
padding
=
padding
)
static_shape
=
tuple
(
output
.
shape
.
as_list
())
dynamic_shape
=
self
.
eval
(
output
,
feed_dict
=
{
input
:
np
.
random
.
rand
(
1
,
h
,
w
,
3
)})
.
shape
self
.
assertTrue
(
static_shape
[
2
]
is
None
)
self
.
assertTrue
(
static_shape
[:
2
]
==
dynamic_shape
[:
2
])
self
.
assertTrue
(
static_shape
[
3
]
==
dynamic_shape
[
3
])
def
run_test_case
(
case
):
def
run_test_case
(
case
):
suite
=
unittest
.
TestLoader
()
.
loadTestsFromTestCase
(
case
)
suite
=
unittest
.
TestLoader
()
.
loadTestsFromTestCase
(
case
)
...
...
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