message: Don't fail in constant folding if we try to materialize a DT_VARIANT or DT_RESOURCE.
  Addresses:
diff: @@ -1090,7 +1090,9 @@ Status CreateConstantTensorAttrValue(DataType type, double value,
  SET_TENSOR_VAL_CASE(DT_QUINT8, int32, int);
  SET_TENSOR_VAL_CASE(DT_BOOL, bool, bool);
  default:
  - return errors::InvalidArgument("Unsupported type: ", type);
  + return errors::InvalidArgument(
  + "Unsupported type in CreateConstantTensorAttrValue: ",
  + DataTypeString(type));
  }
  return Status::OK();
  }
  @@ -1888,13 +1890,15 @@ Status ConstantFolding::ReplaceOperationWithConstant(
  double value, const GraphProperties& properties,
  const TensorShapeProto& shape, NodeDef* node, GraphDef* graph) {
  const DataType dtype = GetDataTypeFromNodeOrProps(*node, properties);
  - if (dtype == DT_INVALID) {
  + AttrValue tensor_attr;
  + Status s = CreateConstantTensorAttrValue(dtype, value, shape, &tensor_attr);
  + if (!s.ok()) {
  + // Fail gracefully without mutating the graph.
  + VLOG(1) << "Failed to replace node " << node->name() << " of type "
  + << DataTypeString(dtype) << " with constant tensor of value "
  + << value;
  return Status::OK();
  }
  -
  - AttrValue tensor_attr;
  - TF_RETURN_IF_ERROR(
  - CreateConstantTensorAttrValue(dtype, value, shape, &tensor_attr));
  return ReplaceOperationWithConstantTensor(dtype, tensor_attr.mutable_tensor(),
  node, graph);
  }
  