Support hexadecimal floats in tensor literals
authorAlex Zinenko <zinenko@google.com>
Tue, 30 Jul 2019 21:24:30 +0000 (14:24 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Tue, 30 Jul 2019 21:24:59 +0000 (14:24 -0700)
commit206be96e63006b08bb159780a031d6def2820c83
tree70f19d9c14e46d3300fa17551218d0399a861d08
parent1de519a753bd5d8dea3fab95cebbbf2ea60fb34f
Support hexadecimal floats in tensor literals

Extend the recently introduced support for hexadecimal float literals to tensor
literals, which may also contain special floating point values such as
infinities and NaNs.

Modify TensorLiteralParser to store the list of tokens representing values
until the type is parsed instead of trying to guess the tensor element type
from the token kinds (hexadecimal values can be either integers or floats, and
can be mixed with both).  Maintain the error reports as close as possible to
the existing implementation to avoid disturbing the tests.  They can be
improved in a separate clean-up if deemed necessary.

PiperOrigin-RevId: 260794716
mlir/lib/Parser/Parser.cpp
mlir/test/IR/invalid.mlir
mlir/test/IR/parser.mlir