class_docstr: Compute energy of each frame. The energy computed for each frame then is normalized so that the values would
  represent energy per `ref_duration`. I.e., if `frame_length` > `sample_rate * ref_duration`,
  
  Args:
      sample_rate (int): sample rate of the audio
      ref_duration (float): reference duration for normalization
      frame_length (int): length of a frame that is used in computing energy
      hop_length (int): hop length aka frame rate. time resolution of the energy computation.
      pad_end (bool): whether to pad at the end of the signal of there would be a otherwise-discarded partial frame
      pad_value (int or float): value to use in the padding
      data_format (str): `channels_first`, `channels_last`, or `default`
      **kwargs: optional keyword args for `tf.keras.layers.Layer()`
  
  Example:
      ::
  
          input_shape = (2048, 1)  # mono signal
          model = Sequential()
          model.add(kapre.Energy(frame_length=1024, hop_length=512, input_shape=input_shape))
          # now the shape is (batch, n_frame=3, ch=1)
code: def __init__(
      self,
      sample_rate=22050,
      ref_duration=0.1,
      frame_length=2205,
      hop_length=1102,
      pad_end=False,
      pad_value=0,
      data_format="default",
      **kwargs,
  ):
      super(Energy, self).__init__(**kwargs)
  
      backend.validate_data_format_str(data_format)
  
      self.sample_rate = sample_rate
      self.ref_duration = ref_duration
      self.frame_length = frame_length
      self.hop_length = hop_length
      self.pad_end = pad_end
      self.pad_value = pad_value
  
      if data_format == _CH_DEFAULT_STR:
          self.data_format = K.image_data_format()
      else:
          self.data_format = data_format
  
      if data_format == _CH_FIRST_STR:
          self.time_axis = 2  # batch, ch, time
      else:
          self.time_axis = 1
  
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
label_desc: Use image node_id 1 to create a new Energy object from inherited base classes: Layer with example: obj = Energy(sample_rate, ref_duration, frame_length, hop_length, pad_end, pad_value, data_format)