(inputs, segment_length, segment_shift_rate=0.5, rand=False)
return segs
param:
    inputs: [time, feat size, 1]
  return:
    list of feats, shape [segment_len, feat size, 1] or None
param:
    inputs: [time, feat size, 1]
  return:
    list of feats, shape [segment_len, feat size, 1] or None
param : inputs : [ time feat size 1 ] return : list of feats shape [ segment_len feat size 1 ] or None
def segments(inputs, segment_length, segment_shift_rate=0.5, rand=False):
  '''
  param:
    inputs: [time, feat size, 1]
  return:
    list of feats, shape [segment_len, feat size, 1] or None
  '''
  if rand:
    return rand_segment(inputs, segment_length)

  segment_shift = int(segment_length * segment_shift_rate)
  length = inputs.shape[0]
  segs = []
  for x in range(0, length, segment_shift):
    end = x + segment_length
    if end < length:
      feature_mat = inputs[x:end, :, :]
    else:
      input_data = inputs
      while input_data.shape[0] < segment_length:
        input_data = np.concatenate([input_data, inputs], 0)

      seg_len = input_data.shape[0]
      elen = seg_len - segment_length - 1
      if elen > 1:
        s = np.round(random.randint(0, elen - 1))
      else:
        s = 0
      e = s + segment_length
      feature_mat = input_data[s:e, :, :]
    segs.append(feature_mat)
  return segs
def segments ( inputs , segment_length , segment_shift_rate = 0.5 , rand = False ) : if rand : return rand_segment ( inputs , segment_length ) segment_shift = int ( segment_length * segment_shift_rate ) length = inputs . shape [ 0 ] segs = [ ] for x in range ( 0 , length , segment_shift ) : end = x + segment_length if end < length : feature_mat = inputs [ x : end , : , : ] else : input_data = inputs while input_data . shape [ 0 ] < segment_length : input_data = np . concatenate ( [ input_data , inputs ] , 0 ) seg_len = input_data . shape [ 0 ] elen = seg_len - segment_length - 1 if elen > 1 : s = np . round ( random . randint ( 0 , elen - 1 ) ) else : s = 0 e = s + segment_length feature_mat = input_data [ s : e , : , : ] segs . append ( feature_mat ) return segs