class_docstr: Stream class. Executes the list of transformations.
  
  The stream can be called directly on a dict of items,
  which get converted into a DataContainer. Note that the DataContainer assumes
  **the same** coordinate system for all the items it is storing.
  For instance, the behavior shown below is not supported for any stream:
  
  .. highlight:: python
  .. code-block:: python
  
      import solt.transforms as slt
      import numpy as np
  
      trf = solt.Stream([slt.Resize(resize_to=(50, 50)),
                             slt.Flip()])
      img1 = np.ones((100, 100, 3), dtype=np.int32)
      img2 = np.ones((110, 110, 3), dtype=np.int32)
      trf({'images': (img1, img2)})
  
  Parameters
  ----------
  transforms : list or None
      List of transforms to execute
  interpolation : str or None
      Stream-wide settings for interpolation. If for some particular transform your would like
      to still use its own mode, simply pass ``(<interpolation_value>, 'strict')``
      in the constructor of that transform.
  padding : str or None
      Stream-wide settings for padding. If for some particular transform your would like
      to still use its own mode, simply pass ``(<padding_value>, 'strict')``
      in the constructor of that transform.
  optimize_stack : bool
      Whether to run transforms stack optimization. It can only be useful if many matrix transformations are
      in a row.
  ignore_fast_mode : bool
      Whether to ignore the fast mode. This option enables full geometric transforms.
class_docstr_tok: ["Stream","class",".","Executes","the","list","of","transformations",".","The","stream","can","be","called","directly","on","a","dict","of","items",",","which","get","converted","into","a","DataContainer",".","Note","that","the","DataContainer","assumes","*","*","the","same","*","*","coordinate","system","for","all","the","items","it","is","storing",".","For","instance",",","the","behavior","shown","below","is","not","supported","for","any","stream",":","..","highlight",":",":","python","..","code-block",":",":","python","import","solt.transforms","as","slt","import","numpy","as","np","trf","=","solt.Stream","(","[","slt.Resize","(","resize_to=","(","50",",","50",")",")",",","slt.Flip","(",")","]",")","img1","=","np.ones","(","(","100",",","100",",","3",")",",","dtype=np.int32",")","img2","=","np.ones","(","(","110",",","110",",","3",")",",","dtype=np.int32",")","trf","(","{","'images","'",":","(","img1",",","img2",")","}",")","Parameters","--","--","--","--","--","transforms",":","list","or","None","List","of","transforms","to","execute","interpolation",":","str","or","None","Stream-wide","settings","for","interpolation",".","If","for","some","particular","transform","your","would","like","to","still","use","its","own","mode",",","simply","pass","``","(","<","interpolation_value",">",",","'strict","'",")","``","in","the","constructor","of","that","transform",".","padding",":","str","or","None","Stream-wide","settings","for","padding",".","If","for","some","particular","transform","your","would","like","to","still","use","its","own","mode",",","simply","pass","``","(","<","padding_value",">",",","'strict","'",")","``","in","the","constructor","of","that","transform",".","optimize_stack",":","bool","Whether","to","run","transforms","stack","optimization",".","It","can","only","be","useful","if","many","matrix","transformations","are","in","a","row",".","ignore_fast_mode",":","bool","Whether","to","ignore","the","fast","mode",".","This","option","enables","full","geometric","transforms","."]
docstr: Static method which fuses the transformations
  
  Parameters
  ----------
  transforms : list
      A list of transforms
  data : DataContainer
      Data container to be used to sample the transforms
  
  Returns
  -------
  out : list
      An optimized list of transforms
docstr_tok: ["Static","method","which","fuses","the","transformations","Parameters","--","--","--","--","--","transforms",":","list","A","list","of","transforms","data",":","DataContainer","Data","container","to","be","used","to","sample","the","transforms","Returns","--","--","--","-","out",":","list","An","optimized","list","of","transforms"]
code: def optimize_transforms_stack(transforms, data):
      """
      Static method which fuses the transformations
  
      Parameters
      ----------
      transforms : list
          A list of transforms
      data : DataContainer
          Data container to be used to sample the transforms
  
      Returns
      -------
      out : list
          An optimized list of transforms
  
      """
      # First we should create a stack
      transforms_stack = []
      for trf in transforms:
          if isinstance(trf, MatrixTransform):
              trf.ignore_fast_mode = True
              trf.reset_state()
              if trf.use_transform():
                  trf.sample_transform(data)
                  if len(transforms_stack) == 0:
                      transforms_stack.append(trf)
                  else:
                      transforms_stack[-1].fuse_with(trf)
          else:
              raise TypeError(
                  "Nested streams or other transforms but the `Matrix` ones are not supported!"
              )
  
      if len(transforms_stack) > 0:
          transforms_stack[-1].correct_transform()
      return transforms_stack
  
file_path: solt/solt/core/_core.py
imports: import numpy
  from ._base_transforms import BaseTransform, MatrixTransform
  import copy
  import random
  from solt.utils import Serializable
  from ._data import DataContainer
label_desc: Use image node_id 6 for calling the Stream obj's underlying member method code with example usage: obj.optimize_transforms_stack(transforms, data) and returns: transforms_stack