pytorch_pfn_extras.training.extensions.snapshot_writers.ThreadQueueWriter#
- class pytorch_pfn_extras.training.extensions.snapshot_writers.ThreadQueueWriter(savefun=<function save>, fs=None, out_dir='', task=None)#
Bases:
QueueWriter[Thread]Snapshot writer that uses a thread queue.
This class creates a thread and a queue by
threadingandqueuemodules respectively. The thread will be a consumer of the queue, and the main thread will be a producer of the queue.Methods
__init__([savefun, fs, out_dir, task])consume(q)create_task(savefun)finalize()Finalizes the writer.
initialize(out_dir)save(filename, out_dir, target, savefun, ...)- Parameters:
savefun (Callable[[...], None]) –
fs (Any) –
out_dir (str) –
task (Optional[Callable[[...], None]]) –
- __init__(savefun=<function save>, fs=None, out_dir='', task=None)#
- Parameters:
savefun (Callable[[...], None]) –
fs (Any) –
out_dir (str) –
task (Optional[Callable[[...], None]]) –
- Return type:
None
- create_consumer(q)#