MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BinaryOpVariants

Function BinaryOpVariants

tensorflow/core/framework/variant_op_registry.h:288–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286//
287template <typename Device>
288Status 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
309namespace variant_op_registry_fn_registration {
310

Callers

nothing calls this directly

Calls 4

InternalFunction · 0.85
GetBinaryOpFnMethod · 0.80
TypeIdMethod · 0.45
TypeNameMethod · 0.45

Tested by

no test coverage detected