paddle/fluid/framework/tensor_util.cc
bool TensorIsfinite(const framework::Tensor& tensor) {
  ContainsInfPredicate pred_inf;
  ContainsNANPredicate pred_nan;
  return !Any(tensor, pred_inf) && !Any(tensor, pred_nan);
}
// NOTE(dzhwinter):
// Isfinite need a AllVisitor to loop through all the elements.
// We choose two cuda call instead of one allvisitor. The AllVisitor
// should be implemented if the performance hurts.
Isfinite need a AllVisitor to loop through all the elements.
We choose two cuda call instead of one allvisitor. The AllVisitor
should be implemented if the performance hurts.
Isfinite need a AllVisitor to loop through all the elements . We choose two cuda call instead of one allvisitor . The AllVisitor should be implemented if the performance hurts .
bool TensorIsfinite(const framework::Tensor& tensor) {
  ContainsInfPredicate pred_inf;
  ContainsNANPredicate pred_nan;
  return !Any(tensor, pred_inf) && !Any(tensor, pred_nan);
}
bool TensorIsfinite ( const framework :: Tensor & tensor ) { ContainsInfPredicate pred_inf ; ContainsNANPredicate pred_nan ; return ! Any ( tensor , pred_inf ) && ! Any ( tensor , pred_nan ) ; }
NOTE(dzhwinter):
Isfinite need a AllVisitor to loop through all the elements.
NOTE ( dzhwinter ) : Isfinite need a AllVisitor to loop through all the elements .