def __init__(self, get_model, input_signature=None, target_signature=None,
                 input=None, trainer=None):
        """
        Args:
            get_model (input1, input2, ... -> keras.Model):
                A function which takes tensors, builds and returns a Keras model.
                It will be part of the tower function.
            input_signature ([tf.TensorSpec]): required. The signature for inputs.
            target_signature ([tf.TensorSpec]): required. The signature for the targets tensors.
            input (InputSource | DataFlow): the InputSource or DataFlow where the input data comes from.
            trainer (Trainer): the default will check the number of available GPUs and use them all.
        """
        self.get_model = get_model
        assert callable(get_model), get_model
        self.input_signature = input_signature
        self.target_signature = target_signature
        if trainer is None:
            nr_gpu = get_nr_gpu()
            if nr_gpu <= 1:
                trainer = SimpleTrainer()
            else:
                # the default multi-gpu trainer
                trainer = SyncMultiGPUTrainerParameterServer(nr_gpu)
        assert isinstance(trainer, Trainer), trainer
        assert not isinstance(trainer, DistributedTrainerBase)

        assert input is not None, "Argument 'input' is required!"
        self.input = apply_default_prefetch(input, trainer)
        self.trainer = trainer

        Args:
            get_model (input1, input2, ... -> keras.Model):
                A function which takes tensors, builds and returns a Keras model.
                It will be part of the tower function.
            input_signature ([tf.TensorSpec]): required. The signature for inputs.
            target_signature ([tf.TensorSpec]): required. The signature for the targets tensors.
            input (InputSource | DataFlow): the InputSource or DataFlow where the input data comes from.
            trainer (Trainer): the default will check the number of available GPUs and use them all.
        
tensorpack/contrib/keras.py