Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
b4e16eb8
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b4e16eb8
编写于
10月 02, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
revert ctc_utils that can work with paddle 2.1.2 and new
上级
913ea33f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
4 deletion
+8
-4
deepspeech/utils/ctc_utils.py
deepspeech/utils/ctc_utils.py
+8
-4
未找到文件。
deepspeech/utils/ctc_utils.py
浏览文件 @
b4e16eb8
...
@@ -87,14 +87,16 @@ def forced_align(ctc_probs: paddle.Tensor, y: paddle.Tensor,
...
@@ -87,14 +87,16 @@ def forced_align(ctc_probs: paddle.Tensor, y: paddle.Tensor,
(
ctc_probs
.
shape
[
0
],
len
(
y_insert_blank
)))
#(T, 2L+1)
(
ctc_probs
.
shape
[
0
],
len
(
y_insert_blank
)))
#(T, 2L+1)
log_alpha
=
log_alpha
-
float
(
'inf'
)
# log of zero
log_alpha
=
log_alpha
-
float
(
'inf'
)
# log of zero
# TODO(Hui Zhang): zeros not support paddle.int16
# self.__setitem_varbase__(item, value) When assign a value to a paddle.Tensor, the data type of the paddle.Tensor not support int16
# self.__setitem_varbase__(item, value) When assign a value to a paddle.Tensor, the data type of the paddle.Tensor not support int16
state_path
=
(
paddle
.
zeros
(
state_path
=
(
paddle
.
zeros
(
(
ctc_probs
.
shape
[
0
],
len
(
y_insert_blank
)),
dtype
=
paddle
.
int32
)
-
1
(
ctc_probs
.
shape
[
0
],
len
(
y_insert_blank
)),
dtype
=
paddle
.
int32
)
-
1
)
# state path, Tuple((T, 2L+1))
)
# state path, Tuple((T, 2L+1))
# init start state
# init start state
log_alpha
[
0
,
0
]
=
ctc_probs
[
0
][
y_insert_blank
[
0
]]
# State-b, Sb
# TODO(Hui Zhang): VarBase.__getitem__() not support np.int64
log_alpha
[
0
,
1
]
=
ctc_probs
[
0
][
y_insert_blank
[
1
]]
# State-nb, Snb
log_alpha
[
0
,
0
]
=
ctc_probs
[
0
][
int
(
y_insert_blank
[
0
])]
# State-b, Sb
log_alpha
[
0
,
1
]
=
ctc_probs
[
0
][
int
(
y_insert_blank
[
1
])]
# State-nb, Snb
for
t
in
range
(
1
,
ctc_probs
.
shape
[
0
]):
# T
for
t
in
range
(
1
,
ctc_probs
.
shape
[
0
]):
# T
for
s
in
range
(
len
(
y_insert_blank
)):
# 2L+1
for
s
in
range
(
len
(
y_insert_blank
)):
# 2L+1
...
@@ -110,9 +112,11 @@ def forced_align(ctc_probs: paddle.Tensor, y: paddle.Tensor,
...
@@ -110,9 +112,11 @@ def forced_align(ctc_probs: paddle.Tensor, y: paddle.Tensor,
log_alpha
[
t
-
1
,
s
-
2
],
log_alpha
[
t
-
1
,
s
-
2
],
])
])
prev_state
=
[
s
,
s
-
1
,
s
-
2
]
prev_state
=
[
s
,
s
-
1
,
s
-
2
]
log_alpha
[
t
,
s
]
=
paddle
.
max
(
candidates
)
+
ctc_probs
[
t
][
# TODO(Hui Zhang): VarBase.__getitem__() not support np.int64
y_insert_blank
[
s
]]
log_alpha
[
t
,
s
]
=
paddle
.
max
(
candidates
)
+
ctc_probs
[
t
][
int
(
y_insert_blank
[
s
])]
state_path
[
t
,
s
]
=
prev_state
[
paddle
.
argmax
(
candidates
)]
state_path
[
t
,
s
]
=
prev_state
[
paddle
.
argmax
(
candidates
)]
# TODO(Hui Zhang): zeros not support paddle.int16
# self.__setitem_varbase__(item, value) When assign a value to a paddle.Tensor, the data type of the paddle.Tensor not support int16
# self.__setitem_varbase__(item, value) When assign a value to a paddle.Tensor, the data type of the paddle.Tensor not support int16
state_seq
=
-
1
*
paddle
.
ones
((
ctc_probs
.
shape
[
0
],
1
),
dtype
=
paddle
.
int32
)
state_seq
=
-
1
*
paddle
.
ones
((
ctc_probs
.
shape
[
0
],
1
),
dtype
=
paddle
.
int32
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录