def _map_tensor(functions, tensors):
    """
    Apply the composition of all functions to all given tensors. If a tensor
    is None, it remains as None.
    :param functions: iterable collection of functions. Each must take a
    tensor and return a tensor of the same size. The first function is
    applied first.
    :param tensors: iterable collection of tensors.
    :return: tuple of tensors with identical shapes to input.
    """
    new_tensors = []

    for tensor in tensors:
        if tensor is None:
            new_tensors.append(None)
        else:
            for fn in functions:
                tensor = fn(tensor)
            new_tensors.append(tensor)

    return tuple(new_tensors)