Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7a6bf83e
提交
7a6bf83e
authored
7月 04, 2017
作者:
João Victor Tozatti Risso
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add _cop_num_outputs to GPU CTC and rename context to context_name
Signed-off-by:
João Victor Tozatti Risso
<
joaovictor.risso@gmail.com
>
上级
b9243185
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
7 行增加
和
20 行删除
+7
-20
ctc_wrapper.c
theano/gpuarray/c_code/ctc_wrapper.c
+0
-14
ctc.py
theano/gpuarray/ctc.py
+7
-6
没有找到文件。
theano/gpuarray/c_code/ctc_wrapper.c
浏览文件 @
7a6bf83e
...
@@ -282,17 +282,3 @@ int APPLY_SPECIFIC(ctc_cost_gpu)(PyGpuArrayObject * in_activations,
...
@@ -282,17 +282,3 @@ int APPLY_SPECIFIC(ctc_cost_gpu)(PyGpuArrayObject * in_activations,
return
0
;
return
0
;
}
}
int
APPLY_SPECIFIC
(
ctc_cost_gpu_no_grad
)(
PyGpuArrayObject
*
in_activations
,
PyArrayObject
*
in_labels
,
PyArrayObject
*
in_input_lengths
,
PyGpuArrayObject
**
out_costs
,
PyGpuContextObject
*
gpu_context
)
{
return
APPLY_SPECIFIC
(
ctc_cost_gpu
)(
in_activations
,
in_labels
,
in_input_lengths
,
out_costs
,
NULL
,
gpu_context
);
}
theano/gpuarray/ctc.py
浏览文件 @
7a6bf83e
...
@@ -30,14 +30,15 @@ class GpuConnectionistTemporalClassification(gof.COp):
...
@@ -30,14 +30,15 @@ class GpuConnectionistTemporalClassification(gof.COp):
"""
"""
__props__
=
(
'compute_grad'
,)
__props__
=
(
'compute_grad'
,)
_cop_num_inputs
=
3
_cop_num_outputs
=
2
func_file
=
"./c_code/ctc_wrapper.c"
func_file
=
"./c_code/ctc_wrapper.c"
func_name
=
"APPLY_SPECIFIC(ctc_cost_gpu)"
func_name
=
"APPLY_SPECIFIC(ctc_cost_gpu)"
params_type
=
gpu_context_type
params_type
=
gpu_context_type
def
__init__
(
self
,
compute_grad
=
True
):
def
__init__
(
self
,
compute_grad
=
True
):
if
not
compute_grad
:
self
.
func_name
=
"APPLY_SPECIFIC(ctc_cost_gpu_no_grad)"
self
.
compute_grad
=
compute_grad
self
.
compute_grad
=
compute_grad
gof
.
COp
.
__init__
(
self
,
self
.
func_file
,
self
.
func_name
)
gof
.
COp
.
__init__
(
self
,
self
.
func_file
,
self
.
func_name
)
...
@@ -90,10 +91,10 @@ class GpuConnectionistTemporalClassification(gof.COp):
...
@@ -90,10 +91,10 @@ class GpuConnectionistTemporalClassification(gof.COp):
'GpuConnectionistTemporalClassification Op '
'GpuConnectionistTemporalClassification Op '
'can not be constructed.'
)
'can not be constructed.'
)
context
=
infer_context_name
(
activations
,
labels
,
input_length
s
)
context
_name
=
infer_context_name
(
activation
s
)
t_activations
=
as_gpuarray_variable
(
activations
,
t_activations
=
as_gpuarray_variable
(
activations
,
context_name
=
context
)
context_name
=
context
_name
)
# Ensure activations array is C-contiguous
# Ensure activations array is C-contiguous
t_activations
=
gpu_contiguous
(
t_activations
)
t_activations
=
gpu_contiguous
(
t_activations
)
...
@@ -115,13 +116,13 @@ class GpuConnectionistTemporalClassification(gof.COp):
...
@@ -115,13 +116,13 @@ class GpuConnectionistTemporalClassification(gof.COp):
costs
=
GpuArrayType
(
dtype
=
'float32'
,
costs
=
GpuArrayType
(
dtype
=
'float32'
,
broadcastable
=
(
False
,),
broadcastable
=
(
False
,),
context_name
=
context
)()
context_name
=
context
_name
)()
outputs
=
[
costs
]
outputs
=
[
costs
]
if
self
.
compute_grad
:
if
self
.
compute_grad
:
gradients
=
GpuArrayType
(
dtype
=
'float32'
,
gradients
=
GpuArrayType
(
dtype
=
'float32'
,
broadcastable
=
(
False
,
False
,
False
,),
broadcastable
=
(
False
,
False
,
False
,),
context_name
=
context
)()
context_name
=
context
_name
)()
outputs
+=
[
gradients
]
outputs
+=
[
gradients
]
return
theano
.
Apply
(
self
,
inputs
=
[
t_activations
,
t_labels
,
t_input_lengths
],
return
theano
.
Apply
(
self
,
inputs
=
[
t_activations
,
t_labels
,
t_input_lengths
],
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论