Set Failure condition on histogram summary op when it encounters NaNs or Infs.

PiperOrigin-RevId: 328814996
Change-Id: Ifdced23abd85c65e2ba714b754f826bba0ab73b7
This commit is contained in:
Bruce Fontaine 2020-08-27 14:19:07 -07:00 committed by TensorFlower Gardener
parent ffc9bef49c
commit 724abc9856

View File

@ -93,11 +93,13 @@ void HistogramSummaryOp_Compute(void* kernel, TF_OpKernelContext* ctx) {
std::ostringstream err;
err << "Nan in summary histogram for: " << k->op_node_name;
TF_SetStatus(status.get(), TF_INVALID_ARGUMENT, err.str().c_str());
TF_OpKernelContext_Failure(ctx, status.get());
return;
} else if (Eigen::numext::isinf(double_val)) {
std::ostringstream err;
err << "Infinity in Histogram for: " << k->op_node_name;
TF_SetStatus(status.get(), TF_INVALID_ARGUMENT, err.str().c_str());
TF_OpKernelContext_Failure(ctx, status.get());
return;
}
histo.Add(double_val);