| 1612 | } |
| 1613 | |
| 1614 | Status DirectSession::PRun(const string& handle, const NamedTensorList& inputs, |
| 1615 | const std::vector<string>& output_names, |
| 1616 | std::vector<Tensor>* outputs) { |
| 1617 | TF_RETURN_IF_ERROR(CheckNotClosed()); |
| 1618 | std::vector<string> parts = str_util::Split(handle, ';'); |
| 1619 | const string& key = parts[0]; |
| 1620 | // Get the executors for this partial run. |
| 1621 | ExecutorsAndKeys* executors_and_keys; |
| 1622 | RunState* run_state; |
| 1623 | { |
| 1624 | mutex_lock l(executor_lock_); // could use reader lock |
| 1625 | auto exc_it = executors_.find(key); |
| 1626 | if (exc_it == executors_.end()) { |
| 1627 | return errors::InvalidArgument( |
| 1628 | "Must run 'setup' before performing partial runs!"); |
| 1629 | } |
| 1630 | executors_and_keys = exc_it->second.get(); |
| 1631 | |
| 1632 | auto prun_it = partial_runs_.find(handle); |
| 1633 | if (prun_it == partial_runs_.end()) { |
| 1634 | return errors::InvalidArgument( |
| 1635 | "Must run 'setup' before performing partial runs!"); |
| 1636 | } |
| 1637 | run_state = prun_it->second.get(); |
| 1638 | |
| 1639 | // Make sure that this is a new set of feeds that are still pending. |
| 1640 | for (const auto& input : inputs) { |
| 1641 | auto it = run_state->pending_inputs.find(input.first); |
| 1642 | if (it == run_state->pending_inputs.end()) { |
| 1643 | return errors::InvalidArgument( |
| 1644 | "The feed ", input.first, |
| 1645 | " was not specified in partial_run_setup."); |
| 1646 | } else if (it->second) { |
| 1647 | return errors::InvalidArgument("The feed ", input.first, |
| 1648 | " has already been fed."); |
| 1649 | } |
| 1650 | } |
| 1651 | // Check that this is a new set of fetches that are still pending. |
| 1652 | for (const auto& output : output_names) { |
| 1653 | auto it = run_state->pending_outputs.find(output); |
| 1654 | if (it == run_state->pending_outputs.end()) { |
| 1655 | return errors::InvalidArgument( |
| 1656 | "The fetch ", output, " was not specified in partial_run_setup."); |
| 1657 | } else if (it->second) { |
| 1658 | return errors::InvalidArgument("The fetch ", output, |
| 1659 | " has already been fetched."); |
| 1660 | } |
| 1661 | } |
| 1662 | } |
| 1663 | |
| 1664 | // Check that this new set of fetches can be computed from all the |
| 1665 | // feeds we have supplied. |
| 1666 | TF_RETURN_IF_ERROR( |
| 1667 | CheckFetch(inputs, output_names, executors_and_keys, run_state)); |
| 1668 | |
| 1669 | // Send inputs. |
| 1670 | Status s = SendPRunInputs(inputs, executors_and_keys, run_state->rendez); |
| 1671 |
nothing calls this directly
no test coverage detected