| 263 | // |
| 264 | template <typename Device> |
| 265 | Status UnaryOpVariant(OpKernelContext* ctx, VariantUnaryOp op, const Variant& v, |
| 266 | Variant* v_out) { |
| 267 | const string& device = DeviceName<Device>::value; |
| 268 | UnaryVariantOpRegistry::VariantUnaryOpFn* unary_op_fn = |
| 269 | UnaryVariantOpRegistry::Global()->GetUnaryOpFn(op, device, v.TypeId()); |
| 270 | if (unary_op_fn == nullptr) { |
| 271 | return errors::Internal( |
| 272 | "No unary variant unary_op function found for unary variant op enum: ", |
| 273 | op, " Variant type_name: ", v.TypeName(), " for device type: ", device); |
| 274 | } |
| 275 | return (*unary_op_fn)(ctx, v, v_out); |
| 276 | } |
| 277 | |
| 278 | // Sets *out = binary_op(a, b). The variants a and b must be the same type |
| 279 | // and have a registered binary_op function for the given Device. Returns an |
nothing calls this directly
no test coverage detected