def METHOD_NAME(self, layer):
    if isinstance(layer, Sequential):
        self._modules = layer._modules
        # copy optimizer
        if hasattr(layer, 'optimizer'):
            setattr(self, 'optimizer', layer.optimizer)
    elif isinstance(layer, FateTorchLayer):
        self.add_module(str(len(self)), layer)
        # update optimizer if dont have
        if not hasattr(self, 'optimizer') and hasattr(layer, 'optimizer'):
            setattr(self, 'optimizer', layer.optimizer)
    else:
        raise ValueError(
            'unknown input layer type {}, this type is not supported'.format(
                type(layer)))