Created by: zhiqiu
As the title, add FLAGS_imperative_check_nan_inf
to control NAN/INF check in imperative mode.
FLAGS_imperative_check_nan_inf = 0
, disable imperative NAN/INF check.
FLAGS_imperative_check_nan_inf = 1
, enable imperative NAN/INF check,
raise exception and stop execution when NAN/INF detected at the first time.
FLAGS_imperative_check_nan_inf = 2
(>1), enable imperative NAN/INF check,
do not raise exception but log the message and continue execution.