| 357 | } |
| 358 | |
| 359 | bool SGDTrainingAlgorithm::evaluate_mini_batch(SGDExecutionContext& c, |
| 360 | model& model, |
| 361 | data_coordinator& dc, |
| 362 | execution_mode mode, |
| 363 | ScopeTimer timer) |
| 364 | { |
| 365 | model.reset_mode(c, mode); |
| 366 | dc.reset_mode(c); |
| 367 | do_batch_begin_cbs(model, mode, ScopeTimer{timer, "batch_begin callbacks"}); |
| 368 | if (get_trainer().background_io_activity_allowed()) { |
| 369 | dc.fetch_data_asynchronous(mode); |
| 370 | } |
| 371 | else { |
| 372 | dc.fetch_active_batch_synchronous(mode); |
| 373 | } |
| 374 | El::Int current_mini_batch_size = dc.get_current_mini_batch_size(mode); |
| 375 | model.set_current_mini_batch_size(current_mini_batch_size); |
| 376 | model.forward_prop(mode); |
| 377 | bool const finished = dc.ready_for_next_fetch(mode); |
| 378 | |
| 379 | model.get_objective_function()->start_evaluation(mode, |
| 380 | current_mini_batch_size); |
| 381 | model.get_objective_function()->finish_evaluation(mode, |
| 382 | current_mini_batch_size); |
| 383 | model.evaluate_metrics(mode, current_mini_batch_size); |
| 384 | model.update_layers(); |
| 385 | c.inc_step(); |
| 386 | do_batch_end_cbs(model, mode, ScopeTimer{timer, "batch_end callbacks"}); |
| 387 | return finished; |
| 388 | } |
| 389 | |
| 390 | std::unique_ptr<SGDExecutionContext> |
| 391 | SGDTrainingAlgorithm::get_new_execution_context() const |
nothing calls this directly
no test coverage detected