Minimum and maximum lowering from TF to XLA.

PiperOrigin-RevId: 269698888
This commit is contained in:
A. Unique TensorFlower 2019-09-17 18:17:09 -07:00 committed by TensorFlower Gardener
parent d3b65857f2
commit 790ff20d98
2 changed files with 17 additions and 1 deletions

View File

@ -97,6 +97,20 @@ func @broadcast_div(%arg0: tensor<1xi32>, %arg1: tensor<1x2xi32>) -> tensor<1x2x
return %0: tensor<1x2xi32>
}
// CHECK-LABEL: func @maximum
func @maximum(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>) -> tensor<4xf32> {
// CHECK: xla_hlo.max %arg0, %arg1 : tensor<4xf32>
%0 = "tf.Maximum"(%arg0, %arg1) : (tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32>
return %0 : tensor<4xf32>
}
// CHECK-LABEL: func @minimum
func @minimum(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>) -> tensor<4xf32> {
// CHECK: xla_hlo.min %arg0, %arg1 : tensor<4xf32>
%0 = "tf.Minimum"(%arg0, %arg1) : (tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32>
return %0 : tensor<4xf32>
}
// CHECK-LABEL: func @mul
func @mul(%arg0: tensor<2xi32>) -> tensor<2xi32> {
// CHECK-NEXT: %0 = xla_hlo.mul %arg0, %arg0 : tensor<2xi32>

View File

@ -80,8 +80,10 @@ class DirectBinaryPat<Op FromOp, Op ToOp>
(ToOp $l, $r, (BinBroadcastDimensions $l, $r))>;
foreach fromToBinPair = [[TF_AddOp, HLO_AddOp],
[TF_AddV2Op, HLO_AddOp],
[TF_AddV2Op, HLO_AddOp],
[TF_DivOp, HLO_DivOp],
[TF_MaximumOp, HLO_MaxOp],
[TF_MinimumOp, HLO_MinOp],
[TF_MulOp, HLO_MulOp],
[TF_RealDivOp, HLO_DivOp],
[TF_SubOp, HLO_SubOp]] in