def batch_flatten(x):
    x = tf.reshape(x, [-1, np.prod(x.get_shape()[1:].as_list())])
    return x
Turn a n-D tensor into a 2D tensor where
dataset/ETHPy150Open fchollet/keras/keras/backend/tensorflow_backend.py/batch_flatten