| 328 | } |
| 329 | |
| 330 | void eval(std::vector<array> outputs) { |
| 331 | if (outputs.empty()) { |
| 332 | return; |
| 333 | } |
| 334 | |
| 335 | if (std::none_of(outputs.begin(), outputs.end(), [](array& x) { |
| 336 | return x.status() == array::Status::unscheduled; |
| 337 | })) { |
| 338 | for (auto& x : outputs) { |
| 339 | x.wait(); |
| 340 | } |
| 341 | return; |
| 342 | } |
| 343 | |
| 344 | eval_impl(std::move(outputs), false).wait(); |
| 345 | } |
| 346 | |
| 347 | std::pair<std::vector<array>, std::vector<array>> vjp( |
| 348 | const std::function<std::vector<array>(const std::vector<array>&)>& fun, |