| 286 | // |
| 287 | template <typename Device> |
| 288 | Status BinaryOpVariants(OpKernelContext* ctx, VariantBinaryOp op, |
| 289 | const Variant& a, const Variant& b, Variant* out) { |
| 290 | if (a.TypeId() != b.TypeId()) { |
| 291 | return errors::Internal( |
| 292 | "BianryOpVariants: Variants a and b have different " |
| 293 | "type ids. Type names: '", |
| 294 | a.TypeName(), "' vs. '", b.TypeName(), "'"); |
| 295 | } |
| 296 | const string& device = DeviceName<Device>::value; |
| 297 | UnaryVariantOpRegistry::VariantBinaryOpFn* binary_op_fn = |
| 298 | UnaryVariantOpRegistry::Global()->GetBinaryOpFn(op, device, a.TypeId()); |
| 299 | if (binary_op_fn == nullptr) { |
| 300 | return errors::Internal( |
| 301 | "No unary variant binary_op function found for binary variant op " |
| 302 | "enum: ", |
| 303 | op, " Variant type_name: '", a.TypeName(), "' for device type: ", |
| 304 | device); |
| 305 | } |
| 306 | return (*binary_op_fn)(ctx, a, b, out); |
| 307 | } |
| 308 | |
| 309 | namespace variant_op_registry_fn_registration { |
| 310 |
nothing calls this directly
no test coverage detected