From fa059259bc841646ae8c0e8c15f1fdc1658090ce Mon Sep 17 00:00:00 2001 From: Adrian Kuegel Date: Wed, 27 Jan 2021 04:48:55 -0800 Subject: [PATCH] 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 --- .../mhlo/transforms/transform_unranked_hlo.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Dialect/mhlo/transforms/transform_unranked_hlo.cc b/lib/Dialect/mhlo/transforms/transform_unranked_hlo.cc index 063d077..0f65421 100644 --- a/lib/Dialect/mhlo/transforms/transform_unranked_hlo.cc +++ b/lib/Dialect/mhlo/transforms/transform_unranked_hlo.cc @@ -34,13 +34,14 @@ namespace mlir { namespace { // TODO(herhut): Generate these out of op definitions. -#define MAP_XLA_OPERATION_CWISE_UNARY(fn, sep) \ - fn(AbsOp) sep fn(CeilOp) sep fn(ClzOp) sep fn(CosOp) sep fn(ExpOp) \ - sep fn(Expm1Op) sep fn(FloorOp) sep fn(ImagOp) sep fn(IsFiniteOp) \ - sep fn(LogOp) sep fn(Log1pOp) sep fn(LogisticOp) sep fn(NotOp) \ - sep fn(NegOp) sep fn(PopulationCountOp) sep fn(RealOp) \ - sep fn(RoundOp) sep fn(RsqrtOp) sep fn(SignOp) sep fn(SinOp) \ - sep fn(SqrtOp) sep fn(TanhOp) +#define MAP_XLA_OPERATION_CWISE_UNARY(fn, sep) \ + fn(AbsOp) sep fn(CeilOp) sep fn(ClzOp) sep fn(ConvertOp) sep fn(CosOp) \ + sep fn(ExpOp) sep fn(Expm1Op) sep fn(FloorOp) sep fn(ImagOp) \ + sep fn(IsFiniteOp) sep fn(LogOp) sep fn(Log1pOp) sep fn(LogisticOp) \ + sep fn(NotOp) sep fn(NegOp) sep fn(PopulationCountOp) \ + sep fn(RealOp) sep fn(RoundOp) sep fn(RsqrtOp) \ + sep fn(SignOp) sep fn(SinOp) sep fn(SqrtOp) \ + sep fn(TanhOp) // TODO(herhut): Generate these out of op definitions. #define MAP_XLA_OPERATION_CWISE_BINARY(fn, sep) \