(self, feat_array, left_context, right_context)
return 0, output_array
splice the feature
        args:
            feat_array: the input feature
            left_context: int type and must >= 0
            right_context: int type and must >= 0
        return:
            -1, array: failed
            0, array: success
splice the feature
        args:
            feat_array: the input feature
            left_context: int type and must >= 0
            right_context: int type and must >= 0
        return:
            -1, array: failed
            0, array: success
splice the feature args : feat_array : the input feature left_context : int type and must > = 0 right_context : int type and must > = 0 return : - 1 array : failed 0 array : success
def splice_frames(self, feat_array, left_context, right_context):
    """
        splice the feature
        args:
            feat_array: the input feature
            left_context: int type and must >= 0
            right_context: int type and must >= 0
        return:
            -1, array: failed
            0, array: success
        """
    if left_context < 0 or right_context < 0:
      return -1, np.array([])

    feat_row, feat_dim = feat_array.shape
    length_for_per_feat = 1 + left_context + right_context
    #aim_feat_dim = feat_dim * length_for_per_feat
    output_list = []
    for row_number in range(feat_row):
      read_row_number_begin = row_number - left_context
      read_row_number_end = row_number + right_context
      if read_row_number_begin < 0 or read_row_number_end >= feat_row:
        tmp_output_list = []
        for tmp_row_number in range(length_for_per_feat):
          read_row_number = row_number + tmp_row_number - left_context
          if read_row_number < 0:
            read_row_number = 0

          if read_row_number >= feat_row:
            read_row_number = feat_row - 1

          tmp_output_list.append(feat_array[read_row_number])
        tmp_output_array = np.hstack(tmp_output_list)
        output_list.append(tmp_output_array)
      else:
        output_list.append(
            feat_array[read_row_number_begin:read_row_number_end + 1].flatten())
    output_array = np.vstack(output_list)
    return 0, output_array
def splice_frames ( self , feat_array , left_context , right_context ) : if left_context < 0 or right_context < 0 : return - 1 , np . array ( [ ] ) feat_row , feat_dim = feat_array . shape length_for_per_feat = 1 + left_context + right_context #aim_feat_dim = feat_dim * length_for_per_feat output_list = [ ] for row_number in range ( feat_row ) : read_row_number_begin = row_number - left_context read_row_number_end = row_number + right_context if read_row_number_begin < 0 or read_row_number_end >= feat_row : tmp_output_list = [ ] for tmp_row_number in range ( length_for_per_feat ) : read_row_number = row_number + tmp_row_number - left_context if read_row_number < 0 : read_row_number = 0 if read_row_number >= feat_row : read_row_number = feat_row - 1 tmp_output_list . append ( feat_array [ read_row_number ] ) tmp_output_array = np . hstack ( tmp_output_list ) output_list . append ( tmp_output_array ) else : output_list . append ( feat_array [ read_row_number_begin : read_row_number_end + 1 ] . flatten ( ) ) output_array = np . vstack ( output_list ) return 0 , output_array