def decollate_network_output(output, _, seq_lengths=None, permutation=None, batch_first=True): """Split output into LF0, V/UV and command signals. Return command signals as hidden state.""" # Split pre-net output (command signals). intern_amps, _ = ModelTrainer.split_batch(output[:, :, 2:], None, seq_lengths, permutation, batch_first) # Split final LF0, V/UV. output, _ = ModelTrainer.split_batch(output[:, :, :2], None, seq_lengths, permutation, batch_first) return output, intern_amps
def decollate_network_output(output, hidden, seq_lengths=None, permutation=None, batch_first=True): # Output of r9y9 Wavenet has batch first, thus output: B x C x T --transpose--> B x T x C output = np.transpose(output, (0, 2, 1)) if not batch_first: # output: B x T x C --transpose--> T x B x C output = np.transpose(output, (1, 0, 2)) return ModelTrainer.split_batch(output, hidden, seq_length_output=seq_lengths, permutation=permutation, batch_first=batch_first)