Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
7d0204e9
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看板
未验证
提交
7d0204e9
编写于
9月 09, 2021
作者:
J
Jackwaterveg
提交者:
GitHub
9月 09, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #816 from PaddlePaddle/bool_mul
float_mul_bool type promote, rhs type promote to lhs type
上级
932889d9
6e4a3aff
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
13 addition
and
17 deletion
+13
-17
deepspeech/models/ds2/conv.py
deepspeech/models/ds2/conv.py
+3
-5
deepspeech/models/ds2/rnn.py
deepspeech/models/ds2/rnn.py
+4
-3
deepspeech/modules/conv.py
deepspeech/modules/conv.py
+3
-5
deepspeech/modules/loss.py
deepspeech/modules/loss.py
+0
-1
deepspeech/modules/rnn.py
deepspeech/modules/rnn.py
+3
-3
未找到文件。
deepspeech/models/ds2/conv.py
浏览文件 @
7d0204e9
...
@@ -106,11 +106,9 @@ class ConvBn(nn.Layer):
...
@@ -106,11 +106,9 @@ class ConvBn(nn.Layer):
# reset padding part to 0
# reset padding part to 0
masks
=
make_non_pad_mask
(
x_len
)
#[B, T]
masks
=
make_non_pad_mask
(
x_len
)
#[B, T]
masks
=
masks
.
unsqueeze
(
1
).
unsqueeze
(
1
)
# [B, 1, 1, T]
masks
=
masks
.
unsqueeze
(
1
).
unsqueeze
(
1
)
# [B, 1, 1, T]
# TODO(Hui Zhang): not support bool multiply
# https://github.com/PaddlePaddle/Paddle/pull/29265
# masks = masks.type_as(x)
# rhs will type promote to lhs
masks
=
masks
.
astype
(
x
.
dtype
)
x
=
x
*
masks
x
=
x
.
multiply
(
masks
)
return
x
,
x_len
return
x
,
x_len
...
...
deepspeech/models/ds2/rnn.py
浏览文件 @
7d0204e9
...
@@ -308,7 +308,8 @@ class RNNStack(nn.Layer):
...
@@ -308,7 +308,8 @@ class RNNStack(nn.Layer):
x
,
x_len
=
rnn
(
x
,
x_len
)
x
,
x_len
=
rnn
(
x
,
x_len
)
masks
=
make_non_pad_mask
(
x_len
)
#[B, T]
masks
=
make_non_pad_mask
(
x_len
)
#[B, T]
masks
=
masks
.
unsqueeze
(
-
1
)
# [B, T, 1]
masks
=
masks
.
unsqueeze
(
-
1
)
# [B, T, 1]
# TODO(Hui Zhang): not support bool multiply
# https://github.com/PaddlePaddle/Paddle/pull/29265
masks
=
masks
.
astype
(
x
.
dtype
)
# rhs will type promote to lhs
x
=
x
.
multiply
(
masks
)
x
=
x
*
masks
return
x
,
x_len
return
x
,
x_len
deepspeech/modules/conv.py
浏览文件 @
7d0204e9
...
@@ -113,11 +113,9 @@ class ConvBn(nn.Layer):
...
@@ -113,11 +113,9 @@ class ConvBn(nn.Layer):
# reset padding part to 0
# reset padding part to 0
masks
=
make_non_pad_mask
(
x_len
)
#[B, T]
masks
=
make_non_pad_mask
(
x_len
)
#[B, T]
masks
=
masks
.
unsqueeze
(
1
).
unsqueeze
(
1
)
# [B, 1, 1, T]
masks
=
masks
.
unsqueeze
(
1
).
unsqueeze
(
1
)
# [B, 1, 1, T]
# TODO(Hui Zhang): not support bool multiply
# https://github.com/PaddlePaddle/Paddle/pull/29265
# masks = masks.type_as(x)
# rhs will type promote to lhs
masks
=
masks
.
astype
(
x
.
dtype
)
x
=
x
*
masks
x
=
x
.
multiply
(
masks
)
return
x
,
x_len
return
x
,
x_len
...
...
deepspeech/modules/loss.py
浏览文件 @
7d0204e9
...
@@ -46,7 +46,6 @@ class CTCLoss(nn.Layer):
...
@@ -46,7 +46,6 @@ class CTCLoss(nn.Layer):
# warp-ctc need activation with shape [T, B, V + 1]
# warp-ctc need activation with shape [T, B, V + 1]
# logits: (B, L, D) -> (L, B, D)
# logits: (B, L, D) -> (L, B, D)
logits
=
logits
.
transpose
([
1
,
0
,
2
])
logits
=
logits
.
transpose
([
1
,
0
,
2
])
# (TODO:Hui Zhang) ctc loss does not support int64 labels
ys_pad
=
ys_pad
.
astype
(
paddle
.
int32
)
ys_pad
=
ys_pad
.
astype
(
paddle
.
int32
)
loss
=
self
.
loss
(
loss
=
self
.
loss
(
logits
,
ys_pad
,
hlens
,
ys_lens
,
norm_by_times
=
self
.
batch_average
)
logits
,
ys_pad
,
hlens
,
ys_lens
,
norm_by_times
=
self
.
batch_average
)
...
...
deepspeech/modules/rnn.py
浏览文件 @
7d0204e9
...
@@ -308,7 +308,7 @@ class RNNStack(nn.Layer):
...
@@ -308,7 +308,7 @@ class RNNStack(nn.Layer):
x
,
x_len
=
rnn
(
x
,
x_len
)
x
,
x_len
=
rnn
(
x
,
x_len
)
masks
=
make_non_pad_mask
(
x_len
)
#[B, T]
masks
=
make_non_pad_mask
(
x_len
)
#[B, T]
masks
=
masks
.
unsqueeze
(
-
1
)
# [B, T, 1]
masks
=
masks
.
unsqueeze
(
-
1
)
# [B, T, 1]
#
TODO(Hui Zhang): not support bool multiply
#
https://github.com/PaddlePaddle/Paddle/pull/29265
masks
=
masks
.
astype
(
x
.
dtype
)
# rhs will type promote to lhs
x
=
x
.
multiply
(
masks
)
x
=
x
*
masks
return
x
,
x_len
return
x
,
x_len
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录