aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/util/device_name_utils.h
diff options
context:
space:
mode:
authorGravatar Rohan Jain <rohanj@google.com>2018-06-25 15:42:59 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-25 15:45:45 -0700
commitf2460fc21b22b65ca57c7ea996e4e8d003aa3371 (patch)
treeb2194b3d6e3d6fadd83350999352953b872d636d /tensorflow/core/util/device_name_utils.h
parent84a7f40c86a5ac3d8c427085dd28eef45036b48f (diff)
Making the device name comparison more robust for RemoteCall and
FunctionBufferingResource. Earlier target_device could be '/cpu:0' and source_device be '/job:localhost/replica:0/task:0/device:CPU:0' and we'd deem them to be different devices which is incorrect. PiperOrigin-RevId: 202032979
Diffstat (limited to 'tensorflow/core/util/device_name_utils.h')
-rw-r--r--tensorflow/core/util/device_name_utils.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/tensorflow/core/util/device_name_utils.h b/tensorflow/core/util/device_name_utils.h
index 0ae28df997..4071a70836 100644
--- a/tensorflow/core/util/device_name_utils.h
+++ b/tensorflow/core/util/device_name_utils.h
@@ -88,10 +88,14 @@ class DeviceNameUtils {
// Parses "fullname" into "*parsed". Returns true iff succeeds.
static bool ParseFullName(StringPiece fullname, ParsedName* parsed);
- // Canonicalizes "fullname". Accepts both legacy, newer and local versions of
- // the device spec. Returns the newer version of the device spec. If we were
- // unable to interpret / parse "fullname" returns "".
- static string CanonicalizeDeviceName(StringPiece fullname);
+ // Canonicalizes "fullname" into "*canonical_name". Uses a fully specified
+ // basename to fill in fields that are missing. Accepts both legacy, newer
+ // and local versions of the device spec. Returns the newer version of the
+ // device spec. If we were unable to interpret / parse "fullname" returns
+ // an error and *canonical_name is set to "".
+ static Status CanonicalizeDeviceName(StringPiece fullname,
+ StringPiece basename,
+ string* canonical_name);
// Returns true if "name" specifies any non-trivial constraint on the device.
static bool HasSomeDetails(const ParsedName& name) {