import torch


def feed_forward_pass(feed, module):
    """Feed the first item in the batch tuple through the provided module.

    Parameters
    ----------
    feed : iterable
        The data loader instance to draw batches from.

    module : torch.nn.Module
        The module which the first element in the batch is fed to.

    Yields
    ------
    batch : iterable
        An iterable that constitutes the batch.

    Details
    -------
    Does not force the module into eval mode! Disables gradients, computes
    a forward pass moves the resulting batch to CPU and converts to numpy.
    """
    def to_numpy(t):  # assumes detached tensor or no_grad
        return t.cpu().numpy()

    with torch.no_grad():
        for X, *rest in feed:
            yield [*map(to_numpy, (module(X), *rest))]