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

Function IsCpuCompatible

tensorflow/core/grappler/optimizers/remapper.cc:332–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330// Checks if we can rewrite a pattern to the `_Fused{Conv2D,MatMul}` on CPU.
331template <typename Pattern>
332bool IsCpuCompatible(const RemapperContext& ctx, const Pattern& matched) {
333 const NodeDef& node = ctx.graph_view.graph()->node(matched.contraction);
334 if (IsConv2D(node)) {
335 return IsCpuCompatibleConv2D(&node);
336 } else if (IsDepthwiseConv2dNative(node)) {
337 if (DisableMKL()) {
338 return false;
339 }
340 return IsCpuCompatibleDepthwiseConv2dNative(&node);
341 } else if (IsMatMul(node)) {
342 return IsCpuCompatibleMatMul(&node);
343 } else {
344 return false;
345 }
346}
347
348// Checks if we can rewrite a pattern to the `_FusedConv2D` on GPU device.
349bool IsGpuCompatible(const RemapperContext& ctx,

Callers 1

IsDeviceCompatibleFunction · 0.85

Calls 9

IsConv2DFunction · 0.85
IsCpuCompatibleConv2DFunction · 0.85
IsDepthwiseConv2dNativeFunction · 0.85
IsMatMulFunction · 0.85
IsCpuCompatibleMatMulFunction · 0.85
DisableMKLFunction · 0.70
nodeMethod · 0.45
graphMethod · 0.45

Tested by

no test coverage detected