我正在复制TTS模型,DeepVoice3. Dataset是LJSpeech-1.1.我找到了一个github (https://github.com/Kyubyong/deepvoice3),但是它是用早期的tensorflow版本编写的,在这里我使用TF-2.0。在数据处理中,我需要将decode_raw函数应用于TensorSliceDataset的输出。但是,我不能将decode_raw函数应用于输出。因此,我的问题是如何将应用于TensorSliceDataset?的输出
我已经将文本转换为维数(13066,)的张量。在最初的回购中,他使用了tf.train.slice_input_producer。对于TF-2.0,我使用tf.data.Dataset.from_tensor_slices将该张量转换为TensorSliceDataset。之后,我无法将decode_raw应用于TensorSliceDataset。下面是代码
# old TF code
texts, mels, dones, mags = tf.train.slice_input_producer([texts, mels, dones, mags], shuffle = True)
# TF 2.0 code
texts = tf.convert_to_tensor(texts)
texts = tf.data.Dataset.from_tensor_slices(texts)
texts = tf.io.decode_raw(texts, tf.int32) # (None,)发布于 2019-06-22 16:57:45
您需要将解析函数应用于dataset对象。而不是这一行
texts = tf.io.decode_raw(texts, tf.int32) # (None,)`使用
texts = texts.map(lambda x: tf.io.decode_raw(x, tf.int32))https://stackoverflow.com/questions/56716948
复制相似问题