Fix a python3 compatibility issue in shell scripts

Change: 122737159
This commit is contained in:
Shanqing Cai 2016-05-19 08:05:53 -08:00 committed by TensorFlower Gardener
parent cce41d3fa3
commit e55e45aef7
2 changed files with 12 additions and 12 deletions

View File

@ -120,8 +120,8 @@ test_mnist_softmax() {
# Check final accuracy # Check final accuracy
FINAL_ACCURACY=$(tail -1 "${LOG_FILE}") FINAL_ACCURACY=$(tail -1 "${LOG_FILE}")
if [[ $(python -c "print ${FINAL_ACCURACY}>0.85") != "True" ]] || if [[ $(python -c "print(${FINAL_ACCURACY}>0.85)") != "True" ]] ||
[[ $(python -c "print ${FINAL_ACCURACY}<=1.00") != "True" ]]; then [[ $(python -c "print(${FINAL_ACCURACY}<=1.00)") != "True" ]]; then
echo "mnist_softmax accuracy check FAILED: "\ echo "mnist_softmax accuracy check FAILED: "\
"FINAL_ACCURACY = ${FINAL_ACCURACY}" "FINAL_ACCURACY = ${FINAL_ACCURACY}"
return 1 return 1
@ -150,8 +150,8 @@ test_mnist_with_summaries() {
# Verify final accuracy # Verify final accuracy
FINAL_ACCURACY=$(tail -1 "${LOG_FILE}" | awk '{print $NF}') FINAL_ACCURACY=$(tail -1 "${LOG_FILE}" | awk '{print $NF}')
if [[ $(python -c "print ${FINAL_ACCURACY}>0.85") != "True" ]] || if [[ $(python -c "print(${FINAL_ACCURACY}>0.85)") != "True" ]] ||
[[ $(python -c "print ${FINAL_ACCURACY}<=1.00") != "True" ]]; then [[ $(python -c "print(${FINAL_ACCURACY}<=1.00)") != "True" ]]; then
echo "mnist_with_summaries accuracy check FAILED: ${FINAL_ACCURACY}<0.90" echo "mnist_with_summaries accuracy check FAILED: ${FINAL_ACCURACY}<0.90"
return 1 return 1
fi fi
@ -188,9 +188,9 @@ test_cifar10_train() {
FINAL_LOSS=$(grep -o "loss = [0-9\.]*" "${LOG_FILE}" | tail -1 | \ FINAL_LOSS=$(grep -o "loss = [0-9\.]*" "${LOG_FILE}" | tail -1 | \
awk '{print $NF}') awk '{print $NF}')
if [[ $(python -c "print ${FINAL_LOSS}<${INIT_LOSS}") != "True" ]] || if [[ $(python -c "print(${FINAL_LOSS}<${INIT_LOSS})") != "True" ]] ||
[[ $(python -c "print ${INIT_LOSS}>=0") != "True" ]] || [[ $(python -c "print(${INIT_LOSS}>=0)") != "True" ]] ||
[[ $(python -c "print ${FINAL_LOSS}>=0") != "True" ]]; then [[ $(python -c "print(${FINAL_LOSS}>=0)") != "True" ]]; then
echo "cifar10_train loss check FAILED: "\ echo "cifar10_train loss check FAILED: "\
"FINAL_LOSS = ${FINAL_LOSS}; INIT_LOSS = ${INIT_LOSS}" "FINAL_LOSS = ${FINAL_LOSS}; INIT_LOSS = ${INIT_LOSS}"
return 1 return 1
@ -269,9 +269,9 @@ test_ptb_word_lm() {
echo "INIT_PERPL=${INIT_PERPL}" echo "INIT_PERPL=${INIT_PERPL}"
echo "FINAL_PERPL=${FINAL_PERPL}" echo "FINAL_PERPL=${FINAL_PERPL}"
if [[ $(python -c "print ${FINAL_PERPL}<${INIT_PERPL}") != "True" ]] || if [[ $(python -c "print(${FINAL_PERPL}<${INIT_PERPL})") != "True" ]] ||
[[ $(python -c "print ${INIT_PERPL}>=0") != "True" ]] || [[ $(python -c "print(${INIT_PERPL}>=0)") != "True" ]] ||
[[ $(python -c "print ${FINAL_PERPL}>=0") != "True" ]]; then [[ $(python -c "print(${FINAL_PERPL}>=0)") != "True" ]]; then
echo "ptb_word_lm perplexity check FAILED: "\ echo "ptb_word_lm perplexity check FAILED: "\
"FINAL_PERPL = ${FINAL_PERPL}; INIT_PERPL = ${INIT_PERPL}" "FINAL_PERPL = ${FINAL_PERPL}; INIT_PERPL = ${INIT_PERPL}"
return 1 return 1

View File

@ -191,6 +191,6 @@ VAL_XENT=$(get_final_val_xent "${WKR_LOG_PREFIX}0.log")
# to verify that the 2-worker training gives significantly lower final cross # to verify that the 2-worker training gives significantly lower final cross
# entropy # entropy
echo "Final validation cross entropy from worker0: ${VAL_XENT}" echo "Final validation cross entropy from worker0: ${VAL_XENT}"
if [[ $(python -c "print ${VAL_XENT}>0") != "True" ]]; then if [[ $(python -c "print(${VAL_XENT}>0)") != "True" ]]; then
die "Sanity checks on the final validation cross entropy values FAILED" die "Sanity checks on the final validation cross entropy values FAILED"
fi fi