message: [XLA] Evaluate tf.sign for real arguments with fewer operations
  We can evaluate it as:
  (x > 0) - (x < 0)
  which should be cheaper than:
  x != x ? 0 : sign(x)
diff: @@ -24,6 +24,7 @@ limitations under the License.
  #include "tensorflow/compiler/xla/client/lib/constants.h"
  #include "tensorflow/compiler/xla/client/lib/math.h"
  #include "tensorflow/compiler/xla/client/xla_builder.h"
  +#include "tensorflow/compiler/xla/primitive_util.h"
  #include "tensorflow/core/framework/kernel_def_builder.h"
  namespace tensorflow {
  @@ -85,8 +86,20 @@ XLAJIT_MAKE_UNARY(Rsqrt, xla::Rsqrt(x));
  XLAJIT_MAKE_UNARY(Sigmoid, xla::Logistic(x));
  // Returns 0 if x is NaN, 0 if x is 0, -1 if x < 0 and 1 if x > 0.
  -XLAJIT_MAKE_UNARY(Sign,
  - xla::Select(xla::Ne(x, x), xla::ZerosLike(x), xla::Sign(x)));
  +static xla::XlaOp Sign(xla::XlaBuilder* b, xla::XlaOp x) {
  + return b->ReportErrorOrReturn([&]() -> xla::StatusOr<xla::XlaOp> {
  + TF_ASSIGN_OR_RETURN(auto shape, b->GetShape(x));
  + if (xla::primitive_util::IsComplexType(shape.element_type())) {
  + return xla::Sign(x);
  + }
  + auto gt = xla::Gt(x, xla::ZerosLike(x));
  + auto lt = xla::Lt(x, xla::ZerosLike(x));
  + return xla::ConvertElementType(gt, shape.element_type()) -
  + xla::ConvertElementType(lt, shape.element_type());
  + });
  +}
  +
  +XLAJIT_MAKE_UNARY(Sign, Sign(b, x));
  XLAJIT_MAKE_UNARY(Sinh, xla::Sinh(x));
  static xla::XlaOp Softplus(xla::XlaBuilder* b, xla::XlaOp features) {
  