def flat2d(x):
    """Flattens all dimensions after the first of the given array

    Useful for collapsing spatial dimensions in a spatiotemporal
    stimulus or filter.
    """
    return x.reshape(x.shape[0], -1)