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

Function IsHostMemory

tensorflow/core/grappler/optimizers/layout_optimizer.cc:380–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378}
379
380bool IsHostMemory(const NodeDef& node, int output_port) {
381 DeviceNameUtils::ParsedName parsed_name;
382 if (DeviceNameUtils::ParseFullName(node.device(), &parsed_name)) {
383 DeviceType device_type(parsed_name.type);
384 Status s = FindKernelDef(device_type, node, nullptr, nullptr);
385 if (s.ok()) {
386 tensorflow::MemoryTypeVector in_mtypes;
387 tensorflow::MemoryTypeVector out_mtypes;
388 s = tensorflow::MemoryTypesForNode(OpRegistry::Global(), device_type,
389 node, &in_mtypes, &out_mtypes);
390 if (s.ok()) {
391 if (out_mtypes[output_port] == HOST_MEMORY) {
392 return true;
393 }
394 }
395 } else {
396 return true;
397 }
398 }
399 return false;
400}
401
402class GraphProcessor {
403 public:

Callers 1

IsInputOnHostMethod · 0.70

Calls 4

FindKernelDefFunction · 0.85
MemoryTypesForNodeFunction · 0.85
deviceMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected