Creates a function that takes a single parameter and calls map with "embedded_computation" on it, and then adds "n" to the result. x {R0F32} -----------> (map) ----> (add) / / embedded_computation --/ n --/
| 123 | // / / |
| 124 | // embedded_computation --/ n --/ |
| 125 | XlaComputation CreateMapPlusN(const XlaComputation& embedded_computation, |
| 126 | float n) { |
| 127 | XlaBuilder builder(TestName()); |
| 128 | auto x = Parameter(&builder, 0, ShapeUtil::MakeShape(F32, {}), "x"); |
| 129 | auto map = Map(&builder, {x}, embedded_computation, {}); |
| 130 | auto constant_n = ConstantR0<float>(&builder, n); |
| 131 | Add(map, constant_n); |
| 132 | auto computation_status = builder.Build(); |
| 133 | TF_CHECK_OK(computation_status.status()); |
| 134 | return computation_status.ConsumeValueOrDie(); |
| 135 | } |
| 136 | |
| 137 | // Creates a binary function with signature (F32, F32) -> Pred |
| 138 | // defined by (x, y) -> x > y. |