tensorflow - 在 tf.print 中动态更改 output_stream 的值/文件?
问题描述
我正在使用 Tensorflow 对波形音频文件进行一些处理,并使用tf.print
withoutput_stream
选项保存它们。
pcm =contrib_audio.encode_wav(processed_audio,16000)
tf.print(output_stream="file:///tmp/test.wav",summarize=-1)
问题是我无法/tmp/test.wav
动态更改值以便存储多个波形文件。
解决方案
请参考以下代码。
# Using a counter
for i in range(1,10):
fname = "test_"+str(i)+".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)
您可以创建动态文本,使其成为唯一的文件名。
推荐阅读
- webpack - 使用带有限制选项的 url-loader 时,是否有任何理由使用 file-loader?
- java - 在没有可用连接时显示 toast 错误并阻止显示 webview
- reactjs - 在 React Table 中触发单元格 onClick 而不是行 onClick
- group-by - 在 SAS 中按组获取最新课程
- mysql - 如何加入两个比较不同结果的查询?
- categories - 子类别 Joomla 3.9 显示在主菜单/类别下
- python - 将点从透视图像转换为单应图像
- javascript - 如何在 JavaScript 中解构对象数组
- python - k8s/python:如何使用 Kubernetes Python 客户端读取密钥?
- go - net/http 身份验证方法不稳定