小编Sol*_*Sol的帖子

tensorflow 2.1.0:没有属性“random_normal”

我试图让 Uber 的 Ludwig 跑起来。我收到关于没有属性“random_normal”的错误。我可以使用这些命令在 Python 中重现错误。

>>> import tensorflow as tf
>>> tf.reduce_sum(tf.random_normal([1000,1000]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'random_normal'
>>> print(tf.__version__)
2.1.0
>>> print(sys.version)
3.7.5 (defaut, Oct 25 2019, 15:51:11)
[GCC 7.3.0]
Run Code Online (Sandbox Code Playgroud)

非常感谢有关如何克服此错误的帮助。

python tensorflow ludwig

17
推荐指数
2
解决办法
2万
查看次数

Google Cloud Speech API识别哪些音频文件类型?

我正在尝试使用Google的Cloud Speech API.这里有文档和代码示例:

https://cloud.google.com/speech/docs/basics
https://cloud.google.com/speech/docs/rest-tutorial
Run Code Online (Sandbox Code Playgroud)

如果我将它指向包含的文件audio.raw,但是没有简短的.wav文件,我可以让示例代码运行得很好.

我不知道音频样本文件的格式是什么:

$ file audio.raw 
audio.raw: data
Run Code Online (Sandbox Code Playgroud)

我的.wav文件可能有10秒的音频,我得到一个空的结果.

我知道这个答案.

谷歌云语音api返回空结果

我之前曾问过我的问题,但问题没有答案.

Cloud Speech API支持哪些类型的音频?

我无法想象我必须得到音频文件的属性恰到好处才能使其工作.我假设一个常见的用例,我的是,有人录制会议,不知道录制的参数,只是想要一个文本文件.

audio google-cloud-platform google-voice-search google-speech-api

7
推荐指数
1
解决办法
6804
查看次数

使用正则表达式从 Perl 中的字符串中删除额外的管道和它们周围的文本

假设我有一个像这样的字符串,我想在 perl 中进行处理。

hello|world|nice|to|meet|you
Run Code Online (Sandbox Code Playgroud)

我想保留前三个管道符号和它们周围的文本并丢弃字符串的其余部分。所以,我最终会这样:

hello|world|nice|to
Run Code Online (Sandbox Code Playgroud)

我想我想做这样的事情:

substitute (zero or more non-pipes followed by a pipe)[3 times] followed by the rest of the string with a back reference to the piece of the regex where I matched the 3 pipes and the characters around them. 
Run Code Online (Sandbox Code Playgroud)

我不确定 perl 中的正则表达式语法。

我可以做我想做的事:

$str = "hello|world|nice|to|meet|you" ;
@a = split(/\|/, $str) ;
print $a[0] . "|" . $a[1] . "|" . $a[2] . "|" . $a[3]
Run Code Online (Sandbox Code Playgroud)

但是,我想看看如何用正则表达式来做到这一点。

regex perl

1
推荐指数
1
解决办法
140
查看次数