From cdbaf19b7bb6b6ccfc1f4123f5121448683cbfa3 Mon Sep 17 00:00:00 2001
From: Asim Shankar <ashankar@google.com>
Date: Fri, 11 Jan 2019 03:03:43 -0800
Subject: [PATCH] [Go]: Allow code in the "master" branch to work against the
 latest C library (1.12)

Fixes #23257 for now.
A more principled way of ensuring that we don't end up in this situation
as the Go API is updated to use new C API features remains to be investigated.

PiperOrigin-RevId: 228856302
---
 tensorflow/go/tensor_handle.go | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tensorflow/go/tensor_handle.go b/tensorflow/go/tensor_handle.go
index 3b06773dd16..09192eccefe 100644
--- a/tensorflow/go/tensor_handle.go
+++ b/tensorflow/go/tensor_handle.go
@@ -123,13 +123,22 @@ func (th *TensorHandle) DeviceName() (string, error) {
 // BackingDeviceName returns the name of the device in whose memory the tensor
 // handle resides. This function will block till the operation that produces
 // `h` has completed.
+//
+// WARNING: The implementation currently returns the same as DeviceName().
+// After TensoFlow 1.13's C library is released, this implementation will
+// be updated to return what the documentation says!
 func (th *TensorHandle) BackingDeviceName() (string, error) {
+	// TODO(ashankar): Restore after TensorFlow 1.13 is released.
+	// See https://github.com/tensorflow/tensorflow/issues/23257#issuecomment-433751410
+	return th.DeviceName()
+	/*
 	status := newStatus()
 	name := C.TFE_TensorHandleBackingDeviceName(th.c, status.c)
 	if err := status.Err(); err != nil {
 		return "", err
 	}
 	return C.GoString(name), nil
+	*/
 }
 
 // ToTensor returns the Tensor referenced by th. It may block if this tensor is