mirror of https://github.com/davisking/dlib.git
Add get_net parameter that allows to call the function without forcing flush to disk (#875)
* Add get_net parameter allowing to call the function without forced flush to disk (see the discussion in #869) * A blindfolded attempt to fix compile error on the CI server
This commit is contained in:
parent
f467236cdd
commit
9d59214062
|
@ -55,6 +55,10 @@ namespace dlib
|
|||
}
|
||||
}
|
||||
|
||||
enum class force_flush_to_disk {
|
||||
no = 0,
|
||||
yes = 1
|
||||
};
|
||||
|
||||
template <
|
||||
typename net_type,
|
||||
|
@ -135,10 +139,11 @@ namespace dlib
|
|||
}
|
||||
|
||||
net_type& get_net (
|
||||
force_flush_to_disk force_flush = force_flush_to_disk::yes
|
||||
)
|
||||
{
|
||||
wait_for_thread_to_pause();
|
||||
sync_to_disk(true);
|
||||
sync_to_disk(force_flush == force_flush_to_disk::yes);
|
||||
propagate_exception();
|
||||
return net;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,13 @@
|
|||
namespace dlib
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
enum class force_flush_to_disk {
|
||||
no = 0,
|
||||
yes = 1
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
template <
|
||||
|
@ -92,6 +99,7 @@ namespace dlib
|
|||
!*/
|
||||
|
||||
net_type& get_net (
|
||||
force_flush_to_disk force_flush = force_flush_to_disk::yes
|
||||
);
|
||||
/*!
|
||||
ensures
|
||||
|
@ -102,8 +110,9 @@ namespace dlib
|
|||
dnn_trainer's constructor.
|
||||
- This function blocks until all threads inside the dnn_trainer have
|
||||
stopped touching the net.
|
||||
- This function will sync the trainer state to disk if the current state
|
||||
hasn't already been synced to disk since the last network modification.
|
||||
- If force_flush is yes, then this function will sync the trainer state to
|
||||
disk if the current state hasn't already been synced to disk since the
|
||||
last network modification.
|
||||
!*/
|
||||
|
||||
const std::vector<solver_type>& get_solvers (
|
||||
|
|
Loading…
Reference in New Issue