Skip to content

Commit

Permalink
Round output scaled log likelihood values to 2 decimal places of prec…
Browse files Browse the repository at this point in the history
…ision for comparisons against baseline
  • Loading branch information
amitaga committed Mar 21, 2016
1 parent d65b186 commit 480214f
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Tests/EndToEndTests/Speech/DNN/WriteCommand/run-test
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,24 @@ else
exit 3
fi

diff $OUTPUT_BASELINE $TEST_RUN_DIR/Output.ScaledLogLikelihood > $TEST_RUN_DIR/output.diff
ExitCode=$?
if [ -s $TEST_RUN_DIR/output.diff ]; then
echo "Error: Output of write command does not match baseline output. See $TEST_RUN_DIR/output.diff"
OUTPUT_CURRENT=$TEST_RUN_DIR/Output.ScaledLogLikelihood

if [ ! -e $OUTPUT_BASELINE ]; then
echo "Error: Cannot find write command's output baseline file $OUTPUT_BASELINE!"
exit 3
fi

exit $ExitCode
if [ ! -e $OUTPUT_CURRENT ]; then
echo "Error: Cannot find write command's output file $OUTPUT_CURRENT!"
exit 3
fi

OUTPUT_DIFF=$TEST_RUN_DIR/Output.ScaledLogLikelihood.diff
awk '{FS=" "} function abs(x) {return ((x < 0.0) ? -x : x)} NR==FNR {for (i=1; i<=NF; i++) a[FNR][i]=$i;} NR!=FNR {for (i=1; i<=NF; i++) {if ((abs($i - a[FNR][i])/abs($i)) > 0.006) printf("Line %d, Field %d: Baseline = %f, Current = %f\n", NR, i, a[FNR][i], $i);}}' $OUTPUT_BASELINE $OUTPUT_CURRENT > $OUTPUT_DIFF

if [ -s $OUTPUT_DIFF ]; then
echo "Error: Output of write command does not match baseline output within specified tolerance. See $OUTPUT_DIFF"
exit 1
fi

exit 0

0 comments on commit 480214f

Please sign in to comment.