在tf.print中动态更改output_stream的值/文件?

问题描述 投票:1回答:1

我正在使用Tensorflow对Wave音频文件进行一些处理并使用tf.printoutput_stream选项保存它们。

pcm =contrib_audio.encode_wav(processed_audio,16000)
tf.print(output_stream="file:///tmp/test.wav",summarize=-1)

问题是我无法动态更改/tmp/test.wav的值这样就可以存储多个wave文件。

tensorflow audio stream wav
1个回答
0
投票

请参考下面的代码。

fname = "test3.wav" #filename
path = "//content/sample_data/" #path to save
fname = "file://{path}{fname}".format(fname=fname, path = path)
tf.print(output_stream=fname,summarize=-1)
© www.soinside.com 2019 - 2024. All rights reserved.