Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | Public Attributes | List of all members
caffe2.python.cached_reader.CachedReader Class Reference
Inheritance diagram for caffe2.python.cached_reader.CachedReader:
caffe2.python.dataio.Reader

Public Member Functions

def __init__ (self, reader, db_type='leveldb', name='cached_reader')
 
def setup_ex (self, init_net, finish_net)
 
def read (self, read_net)
 
def has_cache (self)
 
def build_cache (self, cache_path, overwrite=False)
 
- Public Member Functions inherited from caffe2.python.dataio.Reader
def __init__ (self, schema=None)
 
def schema (self)
 
def setup_ex (self, init_net, finish_net)
 
def read_ex (self, local_init_net, local_finish_net)
 
def read_record_ex (self, local_init_net, local_finish_net)
 
def read (self, read_net)
 
def reset (self, net)
 
def read_record (self, read_net)
 
def execution_step (self, reader_net_name=None, external_should_stop=None)
 

Public Attributes

 original_reader
 
 cache_path
 
 ds_reader
 
 ds
 
 db_type
 
 name
 
 field_names
 

Detailed Description

Reader with persistent in-file cache.

Example usage:
cached_reader = CachedReader(reader)
build_cache_step = cached_reader.build_cache('/tmp/cache.db')
with LocalSession() as session:
    session.run(build_cache_step)

Every time new reader is created, it's expected that build_cache will be
called before setup_ex and usage of the reader. build_cache will check
existence of provided file path and in case it's missing will initialize it
by reading data from original reader. All consequent attempts to read will
ignore original reader (i.e. no additional data will be read from it).

Definition at line 32 of file cached_reader.py.


The documentation for this class was generated from the following file: