This is a simple little module that I use to figure out why programs are giving different output with the same input. Not a common problem, but one I've been asked enough for it to matter.
Here's a simple file that might fail unexpectedly:
import numpy as np
from eval import save_dict, dump_saves
# if we're expecting consistent output we should be using np.zeros instead
arr = np.empty(shape=(6, 1))
save_dict({'arr': arr})
dump_saves()
Run the file twice:
$ python main.py
$ python main.py
This will create a file for each run named variablesX.pk
where X
is replaced
with the run number. You can then evaluate the output by running the eval file:
$ python eval.py
Variables 1: 1
Variables 2: 2
===================================================
Non-matching values for variable arr at 5:
Variables 1:
[[2.02949914e-316]
[0.00000000e+000]
[0.00000000e+000]
[0.00000000e+000]
[0.00000000e+000]
[0.00000000e+000]]
===================================================
Variables 2:
[[7.8067827e-317]
[0.0000000e+000]
[0.0000000e+000]
[0.0000000e+000]
[0.0000000e+000]
[0.0000000e+000]]
===================================================
Failed matching. See above issues.