Commit 9a9b2aeb authored by lucas_miranda's avatar lucas_miranda
Browse files

Added tests for model_utils.py

parent e38ac8e8
......@@ -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)
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment