def batch_flatten(x):
 x = T.reshape(x, (x.shape[0], (T.prod(x.shape) // x.shape[0])))
 return x

def batch_flatten ( x ) : x = T . reshape ( x , ( x . shape [ 0 ] , ( T . prod ( x . shape ) // x . shape [ 0 ] ) ) ) return x
turn a n-d tensor into a 2d tensor where the first dimension is conserved .