[KernelGen] Lower tf.Erf and tf.Erfc ops to CHLO.
This does not include the lowerings from CHLO to LMHLO. PiperOrigin-RevId: 344091604
This commit is contained in:
parent
9f20ef0581
commit
85f92a1651
|
@ -417,6 +417,32 @@ def HLOClient_ConstantLikeOp : HLOClient_Op<"constant_like",
|
||||||
let hasCanonicalizer = 1;
|
let hasCanonicalizer = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def HLOClient_ErfOp : HLOClient_UnaryElementwiseOp<"erf",
|
||||||
|
[NoSideEffect, SameOperandsAndResultShape],
|
||||||
|
HLO_FpTensor> {
|
||||||
|
let summary = "Erfc operator";
|
||||||
|
|
||||||
|
let description = [{
|
||||||
|
Computes the Gauss error function of `x` element-wise.
|
||||||
|
|
||||||
|
erf(x) = erf_impl(x) if |x| < 1
|
||||||
|
= 1 - erfc_impl(x) otherwise
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
def HLOClient_ErfcOp : HLOClient_UnaryElementwiseOp<"erfc",
|
||||||
|
[NoSideEffect, SameOperandsAndResultShape],
|
||||||
|
HLO_FpTensor> {
|
||||||
|
let summary = "Erfc operator";
|
||||||
|
|
||||||
|
let description = [{
|
||||||
|
Computes an approximation of the error function complement (1 - erf(x)).
|
||||||
|
|
||||||
|
erfc(x) = erfc_impl(x) if |x| > 1
|
||||||
|
= 1 - erf_impl(x) otherwise
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Broadcasting compare op
|
// Broadcasting compare op
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -50,7 +50,8 @@ namespace {
|
||||||
|
|
||||||
// TODO(herhut): Generate these out of op definitions.
|
// TODO(herhut): Generate these out of op definitions.
|
||||||
#define MAP_CHLO_OPERATION_CWISE_UNARY(fn, sep) \
|
#define MAP_CHLO_OPERATION_CWISE_UNARY(fn, sep) \
|
||||||
fn(AcosOp) sep fn(AtanOp) sep fn(SinhOp) sep fn(TanOp)
|
fn(AcosOp) sep fn(AtanOp) sep fn(ErfOp) sep fn(ErfcOp) sep fn(SinhOp) \
|
||||||
|
sep fn(TanOp)
|
||||||
|
|
||||||
template <typename OpTy>
|
template <typename OpTy>
|
||||||
inline void AddLegalOpOnRankedTensor(ConversionTarget *target) {
|
inline void AddLegalOpOnRankedTensor(ConversionTarget *target) {
|
||||||
|
|
Loading…
Reference in New Issue