class_docstr: Step that reduces a dimension instead of manually looping on it.
  
  Using this step is equivalent to doing `sum(dact_data, [])` for each dact_data
  that might be a IDT, DIT, or EOT of a DACT (DAtaConTainer) to flatten the data,
  then the data is by default unflattened at the end of the loop in _did_process.
class_docstr_tok: ["Step","that","reduces","a","dimension","instead","of","manually","looping","on","it",".","Using","this","step","is","equivalent","to","doing","`","sum","(","dact_data",",","[","]",")","`","for","each","dact_data","that","might","be","a","IDT",",","DIT",",","or","EOT","of","a","DACT","(","DAtaConTainer",")","to","flatten","the","data",",","then","the","data","is","by","default","unflattened","at","the","end","of","the","loop","in","_did_process","."]
code: def __init__(
      self, wrapped: BaseTransformer, then_unflatten: bool = True
  ):
      MetaStep.__init__(self, wrapped)
      ForceHandleMixin.__init__(self)
  
      self.then_unflatten = then_unflatten
  
      self.spare_ids: Optional[IDT] = None
      # Lengths temporarily stored in _will_process to be able to unflatten the data container in _did_process:
      self.len_ids: List[lens] = []
      self.len_di: List[lens] = []
      self.len_eo: List[lens] = []
  
imports: import copy
  from operator import itemgetter
  from typing import Callable, List, Optional, Tuple, Union
  from neuraxle.base import CX, DACT, BaseStep, BaseTransformer, ForceHandleMixin, ForceHandleOnlyMixin, Identity, MetaStep, NamedStepsList, TruncableJoblibStepSaver
  from neuraxle.data_container import DIT, EOT, IDT, DACTData, ListDataContainer
  from neuraxle.steps.flow import ExecuteIf
  import numpy
label_desc: Use image node_id 1 to create a new FlattenForEach object from inherited base classes: ForceHandleMixin, MetaStep with example: obj = FlattenForEach(wrapped, then_unflatten)