Skip to content

Commit bf40ca3

Browse files
committed
remove extraneous assert functions
1 parent 029a370 commit bf40ca3

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

neural_nets/tests/tests.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,6 @@
4141
TorchMultiHeadedAttentionModule,
4242
)
4343

44-
45-
#######################################################################
46-
# Asserts #
47-
#######################################################################
48-
49-
50-
def assert_is_binary(a):
51-
msg = "Matrix should be one-hot binary"
52-
assert np.array_equal(a, a.astype(bool)), msg
53-
assert np.allclose(np.sum(a, axis=1), np.ones(a.shape[0])), msg
54-
return True
55-
56-
57-
def assert_is_stochastic(a):
58-
msg = "Array should be stochastic along the columns"
59-
assert len(a[a < 0]) == len(a[a > 1]) == 0, msg
60-
assert np.allclose(np.sum(a, axis=1), np.ones(a.shape[0])), msg
61-
return True
62-
63-
6444
#######################################################################
6545
# Data Generators #
6646
#######################################################################
@@ -90,11 +70,6 @@ def random_tensor(shape, standardize=False):
9070
return X
9171

9272

93-
def random_binary_tensor(shape, sparsity=0.5):
94-
X = (np.random.rand(*shape) >= (1 - sparsity)).astype(float)
95-
return X
96-
97-
9873
#######################################################################
9974
# Debug Formatter #
10075
#######################################################################

0 commit comments

Comments
 (0)