Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5045b4df
提交
5045b4df
authored
9月 06, 2014
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2092 from nouiz/gpu_assert
Move Assert to the GPU in both back-end.
上级
8f21de0b
092e81e0
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
41 行增加
和
0 行删除
+41
-0
opt.py
theano/sandbox/cuda/opt.py
+10
-0
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+11
-0
opt.py
theano/sandbox/gpuarray/opt.py
+10
-0
test_opt.py
theano/sandbox/gpuarray/tests/test_opt.py
+10
-0
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
5045b4df
...
...
@@ -1680,6 +1680,16 @@ def local_gpualloc(node):
return
[
new_out
]
@register_opt
()
@local_optimizer
([
theano
.
tensor
.
opt
.
Assert
])
def
local_assert
(
node
):
if
(
isinstance
(
node
.
op
,
theano
.
tensor
.
opt
.
Assert
)
and
node
.
inputs
[
0
]
.
owner
and
isinstance
(
node
.
inputs
[
0
]
.
owner
.
op
,
HostFromGpu
)):
return
[
host_from_gpu
(
node
.
op
(
node
.
inputs
[
0
]
.
owner
.
inputs
[
0
]))]
@register_opt
()
@local_optimizer
([
GpuAlloc
])
def
local_gpualloc_memset_0
(
node
):
...
...
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
5045b4df
...
...
@@ -41,6 +41,17 @@ def test_no_shared_var_graph():
assert
numpy
.
any
(
isinstance
(
x
.
op
,
cuda
.
GpuFromHost
)
for
x
in
l
)
assert
numpy
.
any
(
isinstance
(
x
.
op
,
cuda
.
HostFromGpu
)
for
x
in
l
)
def
test_local_assert
():
x
=
theano
.
tensor
.
fmatrix
()
a
=
theano
.
tensor
.
opt
.
assert_op
(
x
,
theano
.
tensor
.
eq
(
x
,
0
)
.
any
())
f
=
theano
.
function
([
x
],
a
,
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
a_op
=
[
n
for
n
in
topo
if
isinstance
(
n
.
op
,
theano
.
tensor
.
opt
.
Assert
)]
assert
len
(
a_op
)
==
1
assert
isinstance
(
a_op
[
0
]
.
inputs
[
0
]
.
type
,
CudaNdarrayType
)
def
test_int_pow
():
a
=
CudaNdarrayType
([
False
])()
...
...
theano/sandbox/gpuarray/opt.py
浏览文件 @
5045b4df
...
...
@@ -496,6 +496,16 @@ def local_gpua_softmaxwithbias(node):
return
GpuSoftmaxWithBias
()
@register_opt
()
@local_optimizer
([
theano
.
tensor
.
opt
.
Assert
])
def
local_assert
(
node
):
if
(
isinstance
(
node
.
op
,
theano
.
tensor
.
opt
.
Assert
)
and
node
.
inputs
[
0
]
.
owner
and
isinstance
(
node
.
inputs
[
0
]
.
owner
.
op
,
HostFromGpu
)):
return
[
host_from_gpu
(
node
.
op
(
node
.
inputs
[
0
]
.
owner
.
inputs
[
0
]))]
@register_opt
()
@op_lifter
([
gpu_from_host
,
ConvOp
])
def
local_gpu_conv
(
node
):
...
...
theano/sandbox/gpuarray/tests/test_opt.py
浏览文件 @
5045b4df
...
...
@@ -16,6 +16,16 @@ from theano.tests.unittest_tools import SkipTest
from
theano.tensor.tests.test_basic
import
TestSpecifyShape
def
test_local_assert
():
x
=
theano
.
tensor
.
fmatrix
()
a
=
theano
.
tensor
.
opt
.
assert_op
(
x
,
theano
.
tensor
.
eq
(
x
,
0
)
.
any
())
f
=
theano
.
function
([
x
],
a
,
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
a_op
=
[
n
for
n
in
topo
if
isinstance
(
n
.
op
,
theano
.
tensor
.
opt
.
Assert
)]
assert
len
(
a_op
)
==
1
assert
isinstance
(
a_op
[
0
]
.
inputs
[
0
]
.
type
,
GpuArrayType
)
def
test_flatten
():
m
=
theano
.
tensor
.
fmatrix
()
f
=
theano
.
function
([
m
],
m
.
flatten
(),
mode
=
mode_with_gpu
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论