class_docstr: Randomly swap the channel
  
  Args:
      data_format (`str`): specifies the data format of batch input/output
      **kwargs: Keyword args for the parent keras layer (e.g., `name`)
  
  Example:
      ::
  
          input_shape = (2048, 2)  # stereo signal
          n_fft = 1024
          n_hop = n_fft // 2
          kwargs = {
              'sample_rate': 22050,
              'n_freq': n_fft // 2 + 1,
              'n_mels': 128,
              'f_min': 0.0,
              'f_max': 8000,
          }
          model = Sequential()
          model.add(kapre.STFT(n_fft=n_fft, hop_length=n_hop, input_shape=input_shape))
          model.add(Magnitude())
          # (batch, n_frame=3, n_freq=n_fft // 2 + 1, ch=1) and dtype is float
          model.add(ChannelSwap())
          # same shape but with randomly swapped channels.
  
      ::
  
          input_shape = (2048, 4)  # mono signal
          model = Sequential()
          model.add(ChannelSwap(input_shape=input_shape))
          # still (2048, 4) but with randomly swapped channels
class_docstr_tok: ["Randomly","swap","the","channel","Args",":","data_format","(","`","str","`",")",":","specifies","the","data","format","of","batch","input\/output","*","*","kwargs",":","Keyword","args","for","the","parent","keras","layer","(","e.g.",",","`","name","`",")","Example",":",":",":","input_shape","=","(","2048",",","2",")","#","stereo","signal","n_fft","=","1024","n_hop","=","n_fft","\/\/","2","kwargs","=","{","'sample_rate","'",":","22050",",","'n_freq","'",":","n_fft","\/\/","2","+","1",",","'n_mels","'",":","128",",","'f_min","'",":","0.0",",","'f_max","'",":","8000",",","}","model","=","Sequential","(",")","model.add","(","kapre.STFT","(","n_fft=n_fft",",","hop_length=n_hop",",","input_shape=input_shape",")",")","model.add","(","Magnitude","(",")",")","#","(","batch",",","n_frame=3",",","n_freq=n_fft","\/\/","2","+","1",",","ch=1",")","and","dtype","is","float","model.add","(","ChannelSwap","(",")",")","#","same","shape","but","with","randomly","swapped","channels",".",":",":","input_shape","=","(","2048",",","4",")","#","mono","signal","model","=","Sequential","(",")","model.add","(","ChannelSwap","(","input_shape=input_shape",")",")","#","still","(","2048",",","4",")","but","with","randomly","swapped","channels"]
code: def __init__(
      self,
      data_format="default",
      **kwargs,
  ):
      backend.validate_data_format_str(data_format)
  
      if data_format == _CH_DEFAULT_STR:
          self.data_format = K.image_data_format()
      else:
          self.data_format = data_format
  
      super(ChannelSwap, self).__init__(**kwargs)
  
file_path: kapre/kapre/augmentation.py
imports: import tensorflow
  from tensorflow.keras.layers import Layer
  from tensorflow.keras import backend
  from .None import backend
  from .backend import _CH_FIRST_STR, _CH_LAST_STR, _CH_DEFAULT_STR
  import numpy
label_desc: Use image node_id 1 to create a new ChannelSwap object from inherited base classes: Layer with example: obj = ChannelSwap(data_format)