Remove incorrect handling of PrimitiveType::F16 in CreateDenseElementsAttrFromLiteral

PrimitiveType::F16 maps to Eigen::half and interpreting it as float will fail. This incorrect handling is removed for now and later on this type along with bf16 and complex types can be supported by constructing appropriate ElementsAttr.
PiperOrigin-RevId: 306574537
Change-Id: Icbd87b24cdc60656ac62de5a7829340f94594a9d
This commit is contained in:
Smit Hinsu 2020-04-14 21:25:58 -07:00 committed by TensorFlower Gardener
parent 2f65c2468d
commit 5843c0cd7b
1 changed files with 1 additions and 2 deletions

View File

@ -83,12 +83,11 @@ StatusOr<mlir::DenseElementsAttr> CreateDenseElementsAttrFromLiteral(
ConvertTensorShapeToType<mlir::RankedTensorType>( ConvertTensorShapeToType<mlir::RankedTensorType>(
literal.shape(), builder)); literal.shape(), builder));
// TODO(hinsu): Support remaining XLA primitive types.
auto element_type = literal.shape().element_type(); auto element_type = literal.shape().element_type();
switch (element_type) { switch (element_type) {
case PrimitiveType::PRED: case PrimitiveType::PRED:
return CreateDenseAttrFromLiteral<bool>(type, literal); return CreateDenseAttrFromLiteral<bool>(type, literal);
case PrimitiveType::F16:
return CreateDenseAttrFromLiteral<float>(type, literal);
case PrimitiveType::F32: case PrimitiveType::F32:
return CreateDenseAttrFromLiteral<float>(type, literal); return CreateDenseAttrFromLiteral<float>(type, literal);
case PrimitiveType::F64: case PrimitiveType::F64: