Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
5e25dbc6
Commit
5e25dbc6
authored
5 years ago
by
Felix Kleinert
Browse files
Options
Downloads
Patches
Plain Diff
update tests for paperModel
parent
7915b04e
No related branches found
No related tags found
3 merge requests
!90
WIP: new release update
,
!89
Resolve "release branch / CI on gpu"
,
!69
Felix issue077 feat model like in paper
Pipeline
#31703
passed
5 years ago
Stage: test
Stage: pages
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_model_modules/test_model_class.py
+33
-0
33 additions, 0 deletions
test/test_model_modules/test_model_class.py
with
33 additions
and
0 deletions
test/test_model_modules/test_model_class.py
+
33
−
0
View file @
5e25dbc6
...
...
@@ -2,6 +2,7 @@ import keras
import
pytest
from
src.model_modules.model_class
import
AbstractModelClass
from
src.model_modules.model_class
import
MyPaperModel
,
MyTowerModel
,
MyLittleModel
,
MyBranchedModel
class
TestAbstractModelClass
:
...
...
@@ -27,3 +28,35 @@ class TestAbstractModelClass:
assert
hasattr
(
amc
,
"
compile
"
)
is
True
assert
hasattr
(
amc
.
model
,
"
compile
"
)
is
True
assert
amc
.
compile
==
amc
.
model
.
compile
class
TestMyPaperModel
:
@pytest.fixture
def
mpm
(
self
):
return
MyPaperModel
(
window_history_size
=
6
,
window_lead_time
=
4
,
channels
=
9
)
def
test_init
(
self
,
mpm
):
# check if loss number of loss functions fit to model outputs
# same loss fkts. for all tails or different fkts. per tail
if
isinstance
(
mpm
.
model
.
output_shape
,
list
):
assert
(
callable
(
mpm
.
loss
)
or
(
len
(
mpm
.
loss
)
==
1
))
or
(
len
(
mpm
.
loss
)
==
len
(
mpm
.
model
.
output_shape
))
elif
isinstance
(
mpm
.
model
.
output_shape
,
tuple
):
assert
callable
(
mpm
.
loss
)
or
(
len
(
mpm
.
loss
)
==
1
)
def
test_set_model
(
self
,
mpm
):
assert
isinstance
(
mpm
.
model
,
keras
.
Model
)
assert
mpm
.
model
.
layers
[
0
].
output_shape
==
(
None
,
7
,
1
,
9
)
# check output dimensions
if
isinstance
(
mpm
.
model
.
output_shape
,
tuple
):
assert
mpm
.
model
.
output_shape
==
(
None
,
4
)
elif
isinstance
(
mpm
.
model
.
output_shape
,
list
):
for
tail_shape
in
mpm
.
model
.
output_shape
:
assert
tail_shape
==
(
None
,
4
)
else
:
raise
TypeError
(
f
"
Type of model.output_shape as to be a tuple (one tail)
"
f
"
or a list of tuples (multiple tails). Received:
{
type
(
mpm
.
model
.
output_shape
)
}
"
)
def
test_set_loss
(
self
,
mpm
):
assert
callable
(
mpm
.
loss
)
or
(
len
(
mpm
.
loss
)
>
0
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment