提交 a31acbeb 编写于 作者: S Suharsh Sivakumar 提交者: TensorFlower Gardener

Remove pending inputs from RunState of DirectSession::Run.

This is only needed for PartialRun and slows down the Run path.
Change: 143618516
上级 f6d47fa5
......@@ -410,7 +410,7 @@ Status DirectSession::Run(const RunOptions& run_options,
// Create a run state and start execution.
Executor::Args args;
args.step_id = step_id_counter_.fetch_add(1);
RunState run_state(input_tensor_names, output_names, args.step_id, &devices_);
RunState run_state(args.step_id, &devices_);
run_state.rendez = new IntraProcessRendezvous(device_mgr_.get());
CancellationManager step_cancellation_manager;
......@@ -1170,10 +1170,10 @@ Status DirectSession::CreateGraphs(
return ::tensorflow::Status::OK();
}
DirectSession::RunState::RunState(const std::vector<string>& input_names,
const std::vector<string>& output_names,
int64 step_id,
const std::vector<Device*>* devices)
DirectSession::RunState::RunState(
const std::vector<string>& pending_input_names,
const std::vector<string>& pending_output_names, int64 step_id,
const std::vector<Device*>* devices)
: step_container(step_id, [devices](const string& name) {
for (auto d : *devices) {
if (!d->resource_manager()->Cleanup(name).ok()) {
......@@ -1182,14 +1182,18 @@ DirectSession::RunState::RunState(const std::vector<string>& input_names,
}
}) {
// Initially all the feeds and fetches are pending.
for (auto& name : input_names) {
for (auto& name : pending_input_names) {
pending_inputs.emplace(name);
}
for (auto& name : output_names) {
for (auto& name : pending_output_names) {
pending_outputs.emplace(name);
}
}
DirectSession::RunState::RunState(int64 step_id,
const std::vector<Device*>* devices)
: RunState({}, {}, step_id, devices) {}
DirectSession::RunState::~RunState() {
if (rendez != nullptr) {
if (!executors_done.HasBeenNotified()) {
......
......@@ -149,8 +149,10 @@ class DirectSession : public Session {
TensorStore tensor_store;
ScopedStepContainer step_container;
RunState(const std::vector<string>& input_names,
const std::vector<string>& output_names, int64 step_id,
RunState(int64 step_id, const std::vector<Device*>* devices);
RunState(const std::vector<string>& pending_input_names,
const std::vector<string>& pending_output_names, int64 step_id,
const std::vector<Device*>* devices);
~RunState();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册