EngineBase

Provides EngineBase.

class EngineBase.EngineBase[source]

Base class for a backend engine, such as TFEngine.Engine.

classmethod config_get_final_epoch(config)[source]
Parameters:config (Config.Config) –
Return type:int
classmethod get_existing_models(config)[source]
Parameters:config (Config.Config) –
Returns:dict epoch -> model filename
Return type:dict[int,str]
classmethod get_epoch_model(config)[source]

:returns (epoch, modelFilename) :rtype: (int|None, str|None)

classmethod get_train_start_epoch_batch(config)[source]

We will always automatically determine the best start (epoch,batch) tuple based on existing model files. This ensures that the files are present and enforces that there are no old outdated files which should be ignored. Note that epochs start at idx 1 and batches at idx 0. :type config: Config.Config :returns (epoch,batch) :rtype (int,int)

classmethod epoch_model_filename(model_filename, epoch, is_pretrain)[source]
Return type:str
get_epoch_model_filename(self, epoch=None)[source]
Parameters:epoch (int|None) –
Returns:filename, excluding TF specific postfix
Return type:str
get_epoch_str(self)[source]
Returns:e.g. “epoch 3”, or “pretrain epoch 5”
Return type:str
is_pretrain_epoch(self, epoch=None)[source]
Parameters:epoch (int|None) –
Returns:whether this epoch is covered by the pretrain logic
Return type:bool
is_first_epoch_after_pretrain(self)[source]
Returns:whether the current epoch is the first epoch right after pretraining
Return type:bool