Skip to content

Commit c871bb5

Browse files
committed
Update test for TF 2.7
The TF initializer seeding behaviour seems to be broken in 2.7, so using numpy seeding instead.
1 parent f57f334 commit c871bb5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.nengobones.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ ci_scripts:
108108
TF_VERSION: $TF_VERSION
109109
remote_setup:
110110
- conda install -y -c conda-forge cudatoolkit=11.3 cudnn=8.2
111+
- export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$CONDA_PREFIX/lib
111112
- template: remote-script
112113
remote_script: docs
113114
output_name: remote-docs
@@ -117,6 +118,7 @@ ci_scripts:
117118
azure_group: nengo-ci
118119
remote_setup:
119120
- conda install -y -c conda-forge cudatoolkit=11.3 cudnn=8.2
121+
- export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$CONDA_PREFIX/lib
120122
- template: remote-script
121123
remote_script: examples
122124
output_name: remote-examples
@@ -126,6 +128,7 @@ ci_scripts:
126128
azure_group: nengo-ci
127129
remote_setup:
128130
- conda install -y -c conda-forge cudatoolkit=11.3 cudnn=8.2
131+
- export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$CONDA_PREFIX/lib
129132
- template: deploy
130133

131134
codecov_yml: {}

keras_lmu/tests/test_layers.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,16 @@ def test_feedforward_auto_swap(
331331
(tf.keras.layers.SimpleRNNCell(units=10), tf.keras.layers.Dense(units=10), None),
332332
)
333333
@pytest.mark.parametrize("feedforward", (True, False))
334-
def test_hidden_types(hidden_cell, feedforward, rng, seed):
334+
def test_hidden_types(hidden_cell, feedforward, rng):
335335
x = rng.uniform(-1, 1, size=(2, 5, 32))
336336

337337
lmu_params = dict(
338338
memory_d=1,
339339
order=3,
340340
theta=4,
341-
kernel_initializer=tf.keras.initializers.glorot_uniform(seed=seed),
341+
kernel_initializer=tf.keras.initializers.constant(
342+
rng.uniform(-1, 1, size=(32, 1))
343+
),
342344
)
343345

344346
base_lmu = tf.keras.layers.RNN(
@@ -365,7 +367,9 @@ def test_hidden_types(hidden_cell, feedforward, rng, seed):
365367
)
366368
lmu_output = lmu(x)
367369

368-
assert np.allclose(lmu_output, base_output, atol=2e-6 if feedforward else 1e-8)
370+
assert np.allclose(
371+
lmu_output, base_output, atol=2e-6 if feedforward else 1e-8
372+
), np.max(np.abs(lmu_output - base_output))
369373

370374

371375
@pytest.mark.parametrize("feedforward", (True, False))

0 commit comments

Comments
 (0)