class_docstr: Flattens the input. Does not affect the batch size.
  
  Note: If inputs are shaped `(batch,)` without a feature axis, then
  flattening adds an extra channel dimension and output shape is `(batch, 1)`.
  
  Args:
      data_format: A string, one of `"channels_last"` (default) or
          `"channels_first"`. The ordering of the dimensions in the inputs.
          `"channels_last"` corresponds to inputs with shape
          `(batch, ..., channels)` while `"channels_first"` corresponds to
          inputs with shape `(batch, channels, ...)`.
          When unspecified, uses `image_data_format` value found in your Keras
          config file at `~/.keras/keras.json` (if exists). Defaults to
          `"channels_last"`.
  
  Example:
  
  >>> x = keras.Input(shape=(10, 64))
  >>> y = keras.layers.Flatten()(x)
  >>> y.shape
  (None, 640)
class_docstr_tok: ["Flattens","the","input",".","Does","not","affect","the","batch","size",".","Note",":","If","inputs","are","shaped","`","(","batch",",",")","`","without","a","feature","axis",",","then","flattening","adds","an","extra","channel","dimension","and","output","shape","is","`","(","batch",",","1",")","`",".","Args",":","data_format",":","A","string",",","one","of","`","``","channels_last","''","`","(","default",")","or","`","``","channels_first","''","`",".","The","ordering","of","the","dimensions","in","the","inputs",".","`","``","channels_last","''","`","corresponds","to","inputs","with","shape","`","(","batch",",","...",",","channels",")","`","while","`","``","channels_first","''","`","corresponds","to","inputs","with","shape","`","(","batch",",","channels",",","...",")","`",".","When","unspecified",",","uses","`","image_data_format","`","value","found","in","your","Keras","config","file","at","`","~\/.keras\/keras.json","`","(","if","exists",")",".","Defaults","to","`","``","channels_last","''","`",".","Example",":",">",">",">","x","=","keras.Input","(","shape=","(","10",",","64",")",")",">",">",">","y","=","keras.layers.Flatten","(",")","(","x",")",">",">",">","y.shape","(","None",",","640",")"]
code: def __init__(self, data_format=None, **kwargs):
      super().__init__(**kwargs)
      self.data_format = backend.standardize_data_format(data_format)
      self.input_spec = InputSpec(min_ndim=1)
      self._channels_first = self.data_format == "channels_first"
  
file_path: keras/keras/layers/reshaping/flatten.py
imports: import math
  from keras import backend
  from keras import ops
  from keras.api_export import keras_export
  from keras.backend.common.keras_tensor import KerasTensor
  from keras.layers.input_spec import InputSpec
  from keras.layers.layer import Layer
label_desc: Use image node_id 1 to create a new Flatten object from inherited base classes: Layer with example: obj = Flatten(data_format)