def __init__(self, input, infs, tower_name='InferenceTower', tower_func=None, device=0):
        """
        Args:
            input (InputSource or DataFlow): The :class:`InputSource` to run
                inference on.  If given a DataFlow, will use :class:`FeedInput`.
            infs (list): a list of :class:`Inferencer` instances.
            tower_name (str): the name scope of the tower to build.
                If multiple InferenceRunner are used, each needs a different tower_name.
            tower_func (tfutils.TowerFunc or None): the tower function to be used to build the graph.
                By defaults to call `trainer.tower_func` under a `training=False` TowerContext,
                but you can change it to a different tower function
                if you need to inference with several different graphs.
            device (int): the device to use
        """
        if isinstance(input, DataFlow):
            # use infinite=False so that a dataflow without size will stop normally
            # TODO a better way to handle inference size
            input = FeedInput(input, infinite=False)
        assert isinstance(input, InputSource), input
        assert not isinstance(input, StagingInput), input
        self._tower_name = tower_name
        self._device_id = device
        self._device = _device_from_int(device)
        self._tower_func = tower_func
        super(InferenceRunner, self).__init__(input, infs)

        Args:
            input (InputSource or DataFlow): The :class:`InputSource` to run
                inference on.  If given a DataFlow, will use :class:`FeedInput`.
            infs (list): a list of :class:`Inferencer` instances.
            tower_name (str): the name scope of the tower to build.
                If multiple InferenceRunner are used, each needs a different tower_name.
            tower_func (tfutils.TowerFunc or None): the tower function to be used to build the graph.
                By defaults to call `trainer.tower_func` under a `training=False` TowerContext,
                but you can change it to a different tower function
                if you need to inference with several different graphs.
            device (int): the device to use
        
tensorpack/callbacks/inference_runner.py