Remove Device::FillContextMap().

All users now use `Device::TryGetDeviceContext()`.

PiperOrigin-RevId: 272006684
This commit is contained in:
Derek Murray 2019-09-30 10:04:38 -07:00 committed by TensorFlower Gardener
parent 823ab85e60
commit 028c82a779
3 changed files with 1 additions and 25 deletions
tensorflow/core
common_runtime
framework

View File

@ -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

View File

@ -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_; }

View File

@ -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.