From 028c82a779f7538fae8d5cbecf4736d2616d5718 Mon Sep 17 00:00:00 2001 From: Derek Murray Date: Mon, 30 Sep 2019 10:04:38 -0700 Subject: [PATCH] Remove `Device::FillContextMap()`. All users now use `Device::TryGetDeviceContext()`. PiperOrigin-RevId: 272006684 --- tensorflow/core/common_runtime/device.cc | 20 -------------------- tensorflow/core/common_runtime/device.h | 4 ---- tensorflow/core/framework/device_base.h | 2 +- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/tensorflow/core/common_runtime/device.cc b/tensorflow/core/common_runtime/device.cc index 9223fd1ac2c..9925814a48a 100644 --- a/tensorflow/core/common_runtime/device.cc +++ b/tensorflow/core/common_runtime/device.cc @@ -54,24 +54,4 @@ DeviceAttributes Device::BuildDeviceAttributes( return da; } -Status Device::FillContextMap(const Graph* graph, - DeviceContextMap* device_context_map) { - DeviceContext* device_context = nullptr; - TF_RETURN_IF_ERROR(TryGetDeviceContext(&device_context)); - if (device_context) { - device_context_map->resize(graph->num_node_ids()); - for (Node* n : graph->nodes()) { - // Increment the refcount for every assignment to a node. - device_context->Ref(); - // Transfers ownership to value in the DeviceContextMap. - (*device_context_map)[n->id()] = device_context; - } - - // Decrement the refcount, since each node_id in the returned - // map has a reference to the context. - device_context->Unref(); - } - return Status::OK(); -} - } // namespace tensorflow diff --git a/tensorflow/core/common_runtime/device.h b/tensorflow/core/common_runtime/device.h index 07d11f3a876..9b7dadadc3a 100644 --- a/tensorflow/core/common_runtime/device.h +++ b/tensorflow/core/common_runtime/device.h @@ -159,10 +159,6 @@ class Device : public DeviceBase { return Status::OK(); } - // DEPRECATED: Use TryGetDeviceContext instead. - Status FillContextMap(const Graph* graph, - DeviceContextMap* device_context_map); - // Returns the op segment of this device. The caller can reuse op // kernels registered for the same session running on this device. OpSegment* op_segment() { return &op_seg_; } diff --git a/tensorflow/core/framework/device_base.h b/tensorflow/core/framework/device_base.h index fae1ce57201..b6696df699b 100644 --- a/tensorflow/core/framework/device_base.h +++ b/tensorflow/core/framework/device_base.h @@ -142,7 +142,7 @@ class DeviceBase { // "stream" is used in special circumstances (such as the // constructors of Ops) where there is no available OpKernelContext. // "default_context" is used by OpKernelContext whenever a device does not - // supply a DeviceContext for an op in FillContextMap (e.g. when only + // supply a DeviceContext for an op in TryGetDeviceContext() (e.g. when only // using a single stream.) // "event_mgr" is used to delay deallocation of temporary GPU buffers. // TODO(pbar) Work out how to move this out of DeviceBase.