| 93 | } |
| 94 | |
| 95 | const xla::XlaComputation* XlaContext::GetOrCreateMin(const DataType type) { |
| 96 | return LookupOrCreate(type, &min_func_, [type] { |
| 97 | const string type_string = DataTypeString(type); |
| 98 | VLOG(1) << "Building Min() for " << type_string; |
| 99 | xla::XlaBuilder b("min<" + type_string + ">"); |
| 100 | xla::PrimitiveType xla_type; |
| 101 | TF_CHECK_OK(DataTypeToPrimitiveType(type, &xla_type)); |
| 102 | auto x = |
| 103 | xla::Parameter(&b, 0, xla::ShapeUtil::MakeShape(xla_type, {}), "x"); |
| 104 | auto y = |
| 105 | xla::Parameter(&b, 1, xla::ShapeUtil::MakeShape(xla_type, {}), "y"); |
| 106 | xla::Min(x, y); |
| 107 | return b.Build().ConsumeValueOrDie(); |
| 108 | }); |
| 109 | } |
| 110 | |
| 111 | const xla::XlaComputation* XlaContext::GetOrCreateAdd(const DataType type) { |
| 112 | return LookupOrCreate(type, &add_func_, [type] { |
no test coverage detected