| 77 | } |
| 78 | |
| 79 | const xla::XlaComputation* XlaContext::GetOrCreateMax(const DataType type) { |
| 80 | return LookupOrCreate(type, &max_func_, [type] { |
| 81 | const string type_string = DataTypeString(type); |
| 82 | VLOG(1) << "Building Max() for " << type_string; |
| 83 | xla::XlaBuilder b("max<" + type_string + ">"); |
| 84 | xla::PrimitiveType xla_type; |
| 85 | TF_CHECK_OK(DataTypeToPrimitiveType(type, &xla_type)); |
| 86 | auto x = |
| 87 | xla::Parameter(&b, 0, xla::ShapeUtil::MakeShape(xla_type, {}), "x"); |
| 88 | auto y = |
| 89 | xla::Parameter(&b, 1, xla::ShapeUtil::MakeShape(xla_type, {}), "y"); |
| 90 | xla::Max(x, y); |
| 91 | return b.Build().ConsumeValueOrDie(); |
| 92 | }); |
| 93 | } |
| 94 | |
| 95 | const xla::XlaComputation* XlaContext::GetOrCreateMin(const DataType type) { |
| 96 | return LookupOrCreate(type, &min_func_, [type] { |
no test coverage detected