Add template for tf.Cast

Also generate the kernels for all types of casts between signed int and float types.
This requires some adaptations to our build macros so that we can also specify the
output type of a kernel.

PiperOrigin-RevId: 354067727
This commit is contained in:
Adrian Kuegel 2021-01-27 04:48:55 -08:00 committed by TensorFlow MLIR Team
parent 44deae2aa1
commit fa059259bc
1 changed files with 8 additions and 7 deletions

View File

@ -34,13 +34,14 @@ namespace mlir {
namespace { namespace {
// TODO(herhut): Generate these out of op definitions. // TODO(herhut): Generate these out of op definitions.
#define MAP_XLA_OPERATION_CWISE_UNARY(fn, sep) \ #define MAP_XLA_OPERATION_CWISE_UNARY(fn, sep) \
fn(AbsOp) sep fn(CeilOp) sep fn(ClzOp) sep fn(CosOp) sep fn(ExpOp) \ fn(AbsOp) sep fn(CeilOp) sep fn(ClzOp) sep fn(ConvertOp) sep fn(CosOp) \
sep fn(Expm1Op) sep fn(FloorOp) sep fn(ImagOp) sep fn(IsFiniteOp) \ sep fn(ExpOp) sep fn(Expm1Op) sep fn(FloorOp) sep fn(ImagOp) \
sep fn(LogOp) sep fn(Log1pOp) sep fn(LogisticOp) sep fn(NotOp) \ sep fn(IsFiniteOp) sep fn(LogOp) sep fn(Log1pOp) sep fn(LogisticOp) \
sep fn(NegOp) sep fn(PopulationCountOp) sep fn(RealOp) \ sep fn(NotOp) sep fn(NegOp) sep fn(PopulationCountOp) \
sep fn(RoundOp) sep fn(RsqrtOp) sep fn(SignOp) sep fn(SinOp) \ sep fn(RealOp) sep fn(RoundOp) sep fn(RsqrtOp) \
sep fn(SqrtOp) sep fn(TanhOp) sep fn(SignOp) sep fn(SinOp) sep fn(SqrtOp) \
sep fn(TanhOp)
// TODO(herhut): Generate these out of op definitions. // TODO(herhut): Generate these out of op definitions.
#define MAP_XLA_OPERATION_CWISE_BINARY(fn, sep) \ #define MAP_XLA_OPERATION_CWISE_BINARY(fn, sep) \