Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f5f1ffa8
提交
f5f1ffa8
authored
2月 21, 2017
作者:
notoraptor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make code more clear by writing 'int64' directly in castings.
上级
c66b296e
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
17 行删除
+15
-17
pool.py
theano/gpuarray/pool.py
+15
-17
没有找到文件。
theano/gpuarray/pool.py
浏览文件 @
f5f1ffa8
...
@@ -15,8 +15,6 @@ except ImportError as e:
...
@@ -15,8 +15,6 @@ except ImportError as e:
# To make sure theano is importable
# To make sure theano is importable
pass
pass
dtype_name_for_casting
=
'int64'
class
GpuPool
(
CGpuKernelBase
):
class
GpuPool
(
CGpuKernelBase
):
"""
"""
...
@@ -70,9 +68,9 @@ class GpuPool(CGpuKernelBase):
...
@@ -70,9 +68,9 @@ class GpuPool(CGpuKernelBase):
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
raise
TypeError
(
'Padding parameters must be ints.'
)
raise
TypeError
(
'Padding parameters must be ints.'
)
ws
=
theano
.
tensor
.
cast
(
ws
,
dtype_name_for_casting
)
ws
=
theano
.
tensor
.
cast
(
ws
,
'int64'
)
stride
=
theano
.
tensor
.
cast
(
stride
,
dtype_name_for_casting
)
stride
=
theano
.
tensor
.
cast
(
stride
,
'int64'
)
pad
=
theano
.
tensor
.
cast
(
pad
,
dtype_name_for_casting
)
pad
=
theano
.
tensor
.
cast
(
pad
,
'int64'
)
return
Apply
(
self
,
[
inp
,
ws
,
stride
,
pad
],
[
inp
.
type
()])
return
Apply
(
self
,
[
inp
,
ws
,
stride
,
pad
],
[
inp
.
type
()])
...
@@ -190,9 +188,9 @@ class GpuMaxPoolGrad(CGpuKernelBase):
...
@@ -190,9 +188,9 @@ class GpuMaxPoolGrad(CGpuKernelBase):
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
raise
TypeError
(
'Padding parameters must be ints.'
)
raise
TypeError
(
'Padding parameters must be ints.'
)
ws
=
theano
.
tensor
.
cast
(
ws
,
dtype_name_for_casting
)
ws
=
theano
.
tensor
.
cast
(
ws
,
'int64'
)
stride
=
theano
.
tensor
.
cast
(
stride
,
dtype_name_for_casting
)
stride
=
theano
.
tensor
.
cast
(
stride
,
'int64'
)
pad
=
theano
.
tensor
.
cast
(
pad
,
dtype_name_for_casting
)
pad
=
theano
.
tensor
.
cast
(
pad
,
'int64'
)
return
Apply
(
self
,
[
inp
,
out
,
out_grad
,
ws
,
stride
,
pad
],
[
inp
.
type
()])
return
Apply
(
self
,
[
inp
,
out
,
out_grad
,
ws
,
stride
,
pad
],
[
inp
.
type
()])
...
@@ -269,9 +267,9 @@ class GpuAveragePoolGrad(CGpuKernelBase):
...
@@ -269,9 +267,9 @@ class GpuAveragePoolGrad(CGpuKernelBase):
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
raise
TypeError
(
'Padding parameters must be ints.'
)
raise
TypeError
(
'Padding parameters must be ints.'
)
ws
=
theano
.
tensor
.
cast
(
ws
,
dtype_name_for_casting
)
ws
=
theano
.
tensor
.
cast
(
ws
,
'int64'
)
stride
=
theano
.
tensor
.
cast
(
stride
,
dtype_name_for_casting
)
stride
=
theano
.
tensor
.
cast
(
stride
,
'int64'
)
pad
=
theano
.
tensor
.
cast
(
pad
,
dtype_name_for_casting
)
pad
=
theano
.
tensor
.
cast
(
pad
,
'int64'
)
return
Apply
(
self
,
[
inp
,
out_grad
,
ws
,
stride
,
pad
],
[
inp
.
type
()])
return
Apply
(
self
,
[
inp
,
out_grad
,
ws
,
stride
,
pad
],
[
inp
.
type
()])
...
@@ -351,9 +349,9 @@ class GpuDownsampleFactorMaxGradGrad(CGpuKernelBase):
...
@@ -351,9 +349,9 @@ class GpuDownsampleFactorMaxGradGrad(CGpuKernelBase):
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
raise
TypeError
(
'Padding parameters must be ints.'
)
raise
TypeError
(
'Padding parameters must be ints.'
)
ws
=
theano
.
tensor
.
cast
(
ws
,
dtype_name_for_casting
)
ws
=
theano
.
tensor
.
cast
(
ws
,
'int64'
)
stride
=
theano
.
tensor
.
cast
(
stride
,
dtype_name_for_casting
)
stride
=
theano
.
tensor
.
cast
(
stride
,
'int64'
)
pad
=
theano
.
tensor
.
cast
(
pad
,
dtype_name_for_casting
)
pad
=
theano
.
tensor
.
cast
(
pad
,
'int64'
)
return
Apply
(
self
,
[
inp
,
out
,
out_grad
,
ws
,
stride
,
pad
],
[
inp
.
type
()])
return
Apply
(
self
,
[
inp
,
out
,
out_grad
,
ws
,
stride
,
pad
],
[
inp
.
type
()])
...
@@ -430,9 +428,9 @@ class GpuMaxPoolRop(CGpuKernelBase):
...
@@ -430,9 +428,9 @@ class GpuMaxPoolRop(CGpuKernelBase):
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
if
pad
.
dtype
not
in
theano
.
tensor
.
int_dtypes
:
raise
TypeError
(
'Padding parameters must be ints.'
)
raise
TypeError
(
'Padding parameters must be ints.'
)
ws
=
theano
.
tensor
.
cast
(
ws
,
dtype_name_for_casting
)
ws
=
theano
.
tensor
.
cast
(
ws
,
'int64'
)
stride
=
theano
.
tensor
.
cast
(
stride
,
dtype_name_for_casting
)
stride
=
theano
.
tensor
.
cast
(
stride
,
'int64'
)
pad
=
theano
.
tensor
.
cast
(
pad
,
dtype_name_for_casting
)
pad
=
theano
.
tensor
.
cast
(
pad
,
'int64'
)
return
Apply
(
self
,
[
inp
,
eval_point
,
ws
,
stride
,
pad
],
[
eval_point
.
type
()])
return
Apply
(
self
,
[
inp
,
eval_point
,
ws
,
stride
,
pad
],
[
eval_point
.
type
()])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论