Flatten¶
- class
dragon.vm.tensorflow.keras.layers.
Flatten
(
data_format=None,
**kwargs
)[source]¶ Layer to reshape input into a matrix.
Examples:
# Reshape an input taking 2 dimensions or more m = tf.keras.layers.Flatten() x2d = m(tf.ones([24, 1])) # (24, 1) x4d = m(tf.ones([1, 2, 3, 4])) # (1, 24) # Set the ``data_format`` to 'channels_first' # will transpose the input before flattening mm = tf.keras.layers.Flatten(data_format='channels_first') x = tf.random.uniform([1, 2, 3]) print(m(x)) print(mm(x))