Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
3adaf7f5
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3adaf7f5
编写于
3月 13, 2018
作者:
X
Xinghai Sun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add comments for new classes.
上级
4987f5c5
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
21 addition
and
1 deletion
+21
-1
fluid/DeepASR/data_utils/async_data_reader.py
fluid/DeepASR/data_utils/async_data_reader.py
+0
-1
fluid/DeepASR/data_utils/util.py
fluid/DeepASR/data_utils/util.py
+21
-0
未找到文件。
fluid/DeepASR/data_utils/async_data_reader.py
浏览文件 @
3adaf7f5
...
@@ -11,7 +11,6 @@ import time
...
@@ -11,7 +11,6 @@ import time
import
numpy
as
np
import
numpy
as
np
from
threading
import
Thread
from
threading
import
Thread
import
signal
import
signal
import
multiprocessing
from
multiprocessing
import
Manager
,
Process
from
multiprocessing
import
Manager
,
Process
import
data_utils.augmentor.trans_mean_variance_norm
as
trans_mean_variance_norm
import
data_utils.augmentor.trans_mean_variance_norm
as
trans_mean_variance_norm
import
data_utils.augmentor.trans_add_delta
as
trans_add_delta
import
data_utils.augmentor.trans_add_delta
as
trans_add_delta
...
...
fluid/DeepASR/data_utils/util.py
浏览文件 @
3adaf7f5
...
@@ -77,6 +77,15 @@ class CriticalException(Exception):
...
@@ -77,6 +77,15 @@ class CriticalException(Exception):
class
SharedNDArray
(
object
):
class
SharedNDArray
(
object
):
"""SharedNDArray utilizes shared memory to avoid data serialization when
object of which shared between different processes. We can reconstruct the
ndarray when memory address provided.
Args:
name (str): Address name of shared memory.
is_verify (bool): Whether to do validation for writing operation.
"""
def
__init__
(
self
,
name
,
is_verify
=
False
):
def
__init__
(
self
,
name
,
is_verify
=
False
):
self
.
_name
=
name
self
.
_name
=
name
self
.
_shm
=
None
self
.
_shm
=
None
...
@@ -130,6 +139,18 @@ class SharedNDArray(object):
...
@@ -130,6 +139,18 @@ class SharedNDArray(object):
class
SharedMemoryPoolManager
(
object
):
class
SharedMemoryPoolManager
(
object
):
"""SharedMemoryPoolManager maintains a multiprocessing.Manager.dict object.
All available addresses are allocated once and will be reused. Though this
class is not process-safe, the pool can be shared between processes. All
shared memory should be unlinked before the main process exited.
Args:
pool_size (int): Size of shared memory pool.
manager (dict): A multiprocessing.Manager object, the pool is
maintained by the proxy process.
name_prefix (str): Address prefix of shared memory.
"""
def
__init__
(
self
,
pool_size
,
manager
,
name_prefix
=
'/deep_asr'
):
def
__init__
(
self
,
pool_size
,
manager
,
name_prefix
=
'/deep_asr'
):
self
.
_names
=
[]
self
.
_names
=
[]
self
.
_dict
=
manager
.
dict
()
self
.
_dict
=
manager
.
dict
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录