Flatten

class dragon.vm.tensorflow.keras.layers.Flatten(
  data_format=None,
  **kwargs
)[source]

The layer to reshape input into a matrix.

Examples:

# Reshape an input taking any dimensions
m = tf.keras.layers.Flatten()
x1d = m(tf.ones([24]))  # (24, 1)
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))

__init__

Flatten.__init__(
  data_format=None,
  **kwargs
)[source]

Create a Flatten layer.

Parameters:
  • data_format ({'channels_first', 'channels_last'}, optional) – The optional data format.