message: Replacing DCHECKs with status in TF's shape inference constant folding.
diff: @@ -406,15 +406,19 @@ Status ShapeRefiner::EvaluateConstantIntScalarEdge(const Node* node,
  TF_RETURN_IF_ERROR(
  EvaluateConstantTensorForEdge(node, dst_idx, evaluated, &scalar));
  if (*evaluated) {
  - DCHECK_EQ(scalar.NumElements(), 1)
  - << "EvaluateConstantIntScalarEdge called on non-scalar edge: "
  - << scalar.NumElements();
  + if (scalar.NumElements() != 1) {
  + return errors::InvalidArgument(
  + "EvaluateConstantIntScalarEdge called on non-scalar edge: ",
  + scalar.NumElements());
  + }
  if (scalar.dtype() == DT_INT32) {
  *result = scalar.scalar<int32>()();
  } else {
  - DCHECK_EQ(scalar.dtype(), DT_INT64)
  - << "EvaluateConstantIntScalarEdge called on non-integer edge: "
  - << scalar.dtype();
  + if (scalar.dtype() != DT_INT64) {
  + return errors::InvalidArgument(
  + "EvaluateConstantIntScalarEdge called on non-integer edge: ",
  + scalar.dtype());
  + }
  *result = scalar.scalar<int64>()();
  }
  }
  