Skip to content

Commit ac9e75a

Browse files
committed
test check rec opt out, better out comparison debug
1 parent 91d228e commit ac9e75a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/test_TFNetworkRecLayer.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3445,9 +3445,14 @@ def check_reclayer_optimize_out(subnet_layer_dict, other_subnet_layers=None, sha
34453445
print("check batch %i, time %i" % (b, t))
34463446
y1_np_, y2_np_ = y1_np[b, t], y2_np[b, t]
34473447
for idx in numpy.ndindex(*y1_np_.shape):
3448-
print(" check", idx)
3449-
assert_allclose(y1_np_[idx], y2_np_[idx], rtol=rtol)
3450-
assert_allclose(y1_np, y2_np, rtol=rtol)
3448+
y1_np__, y2_np__ = y1_np_[idx], y2_np_[idx]
3449+
allclose = numpy.allclose(y1_np__, y2_np__, rtol=rtol)
3450+
if allclose:
3451+
details = ["all close"]
3452+
else:
3453+
details = ["not all close", "max1:", numpy.max(y1_np__), "max2:", numpy.max(y2_np__)]
3454+
print(" check", idx, *details)
3455+
assert_allclose(y1_np, y2_np, rtol=rtol) # fail now
34513456

34523457

34533458
def test_reclayer_optimize_out_linear():

0 commit comments

Comments
 (0)