base class for input data adapters the purpose of a dataadapter is to provide a unfied interface to iterate over input data provided in a variety of formats such as numpy arrays tf tensors tf data datasets keras pydatasets etc get a python iterable for the dataadapter that yields numpy arrays returns a python iterator get a tf data dataset instance for the dataadapter note that the dataset returned does not repeat for epoch so caller might need to create new iterator for the same dataset at the beginning of the epoch this behavior might change in the future returns a tf data dataset caller might use the dataset in different context e g iterdataset in eager to get the value directly or in graph mode provide the iterator tensor to keras model function return the size number of batches for the dataset created for certain type of the data input the number of batches is known eg for numpy data the size is same as numberofelement batchsize whereas for dataset or python generator the size is unknown since it may or may not have an end state returns int the number of batches for the dataset or none if it is unknown the caller could use this to control the loop of training show progress bar or handle unexpected stopiteration error return the batch size of the dataset created for certain type of the data input the batch size is known and even required like numpy array whereas for dataset the batch is unknown unless we take a peek returns int the batch size of the dataset or none if it is unknown whether the dataset has partial batch at the end raise notimplementederror property def partialbatchsizeself raise notimplementederror def onepochendself base class for input data adapters the purpose of a dataadapter is to provide a unfied interface to iterate over input data provided in a variety of formats such as numpy arrays tf tensors tf data datasets keras pydatasets etc get a python iterable for the dataadapter that yields numpy arrays returns a python iterator get a tf data dataset instance for the dataadapter note that the dataset returned does not repeat for epoch so caller might need to create new iterator for the same dataset at the beginning of the epoch this behavior might change in the future returns a tf data dataset caller might use the dataset in different context e g iter dataset in eager to get the value directly or in graph mode provide the iterator tensor to keras model function return the size number of batches for the dataset created for certain type of the data input the number of batches is known eg for numpy data the size is same as number_of_element batch_size whereas for dataset or python generator the size is unknown since it may or may not have an end state returns int the number of batches for the dataset or none if it is unknown the caller could use this to control the loop of training show progress bar or handle unexpected stopiteration error return the batch size of the dataset created for certain type of the data input the batch size is known and even required like numpy array whereas for dataset the batch is unknown unless we take a peek returns int the batch size of the dataset or none if it is unknown whether the dataset has partial batch at the end the size of the final partial batch for dataset will return none if has_partial_batch is false or batch_size is none a hook called after each epoch
class DataAdapter(object):
    

    def get_numpy_iterator(self):
        
        raise NotImplementedError

    def get_tf_dataset(self):
        
        raise NotImplementedError

    @property
    def num_batches(self):
        
        raise NotImplementedError

    @property
    def batch_size(self):
        
        raise NotImplementedError

    @property
    def has_partial_batch(self):
        
        raise NotImplementedError

    @property
    def partial_batch_size(self):
        
        raise NotImplementedError

    def on_epoch_end(self):
        
        pass