Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lucas Miranda
deepOF
Commits
9a9b2aeb
Commit
9a9b2aeb
authored
Sep 17, 2020
by
lucas_miranda
Browse files
Added tests for model_utils.py
parent
e38ac8e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
deepof/model_utils.py
View file @
9a9b2aeb
...
...
@@ -21,9 +21,24 @@ tfpl = tfp.layers
# Helper functions
@
tf
.
function
def
far_away_uniform_initialiser
(
shape
,
minval
=
0
,
maxval
=
15
,
iters
=
100000
):
def
far_away_uniform_initialiser
(
shape
:
tuple
,
minval
:
int
=
0
,
maxval
:
int
=
15
,
iters
:
int
=
100000
)
->
tf
.
Tensor
:
"""
Returns a uniformly initialised matrix in which the columns are as far as possible
Parameters:
- shape (tuple): shape of the object to generate.
- minval (int): Minimum value of the uniform distribution from which to sample
- maxval (int): Maximum value of the uniform distribution from which to sample
- iters (int): the algorithm generates values at random and keeps those runs that
are the farthest apart. Increasing this parameter will lead to more accurate,
results while making the function run slowlier.
Returns:
- init (tf.Tensor): tensor of the specified shape in which the column vectors
are as far as possible
"""
init
=
tf
.
random
.
uniform
(
shape
,
minval
,
maxval
)
...
...
tests/test_model_utils.py
View file @
9a9b2aeb
...
...
@@ -11,7 +11,87 @@ Testing module for deepof.model_utils
from
hypothesis
import
given
from
hypothesis
import
settings
from
hypothesis
import
strategies
as
st
from
collections
import
defaultdict
from
deepof.utils
import
*
import
deepof.preprocess
import
pytest
import
deepof.model_utils
@
settings
(
deadline
=
None
)
@
given
(
shape
=
st
.
tuples
(
st
.
integers
(
min_value
=
2
,
max_value
=
10
),
st
.
integers
(
min_value
=
2
,
max_value
=
10
)
)
)
def
test_far_away_uniform_initialiser
(
shape
):
far
=
deepof
.
model_utils
.
far_away_uniform_initialiser
(
shape
,
0
,
15
,
100
)
assert
far
.
shape
==
shape
# @settings(deadline=None)
# @given()
# def test_compute_kernel():
# pass
#
# @settings(deadline=None)
# @given()
# def test_compute_mmd():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_onecyclescheduler():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_far_away_uniform_initialiser():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_uncorrelated_features_constraint():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_mcdropout():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_kldivergence_layer():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_dense_transpose():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_mmdiscrepancy_layer():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_gaussian_mixture_overlap():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_dead_neuron_control():
# pass
#
#
# @settings(deadline=None)
# @given()
# def test_entropy_regulariser():
# pass
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