Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b0a20106
提交
b0a20106
authored
6月 03, 2015
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2999 from nouiz/crash_test
[CRASH,TESTS] Fix crash recently introduced and fix tests
上级
e2775418
e3c4c093
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
17 行增加
和
25 行删除
+17
-25
basic_ops.py
theano/sandbox/cuda/basic_ops.py
+1
-1
opt.py
theano/sandbox/cuda/opt.py
+1
-0
test_blas.py
theano/sandbox/cuda/tests/test_blas.py
+9
-9
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+0
-7
basic_ops.py
theano/sandbox/gpuarray/basic_ops.py
+6
-8
没有找到文件。
theano/sandbox/cuda/basic_ops.py
浏览文件 @
b0a20106
...
@@ -34,7 +34,7 @@ _logger = logging.getLogger(_logger_name)
...
@@ -34,7 +34,7 @@ _logger = logging.getLogger(_logger_name)
def
as_cuda_ndarray_variable
(
x
):
def
as_cuda_ndarray_variable
(
x
):
if
x
.
owner
:
if
getattr
(
x
,
'owner'
,
None
)
:
if
isinstance
(
x
.
owner
.
op
,
HostFromGpu
):
if
isinstance
(
x
.
owner
.
op
,
HostFromGpu
):
return
x
.
owner
.
inputs
[
0
]
return
x
.
owner
.
inputs
[
0
]
elif
(
isinstance
(
x
.
owner
.
op
,
GpuFromHost
)
and
elif
(
isinstance
(
x
.
owner
.
op
,
GpuFromHost
)
and
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
b0a20106
...
@@ -1963,6 +1963,7 @@ gpu_elemwise_alloc = gof.local_optimizer([GpuElemwise])(
...
@@ -1963,6 +1963,7 @@ gpu_elemwise_alloc = gof.local_optimizer([GpuElemwise])(
tensor
.
opt
.
local_elemwise_alloc_op
(
GpuElemwise
,
GpuAlloc
,
GpuDimShuffle
)
tensor
.
opt
.
local_elemwise_alloc_op
(
GpuElemwise
,
GpuAlloc
,
GpuDimShuffle
)
)
)
register_opt
()(
gpu_elemwise_alloc
)
register_opt
()(
gpu_elemwise_alloc
)
register_opt
()(
tensor
.
opt
.
local_useless_elemwise
)
# needed by gpu_elemwise_alloc
tensor
.
opt
.
register_specialize_device
(
gpu_elemwise_alloc
)
tensor
.
opt
.
register_specialize_device
(
gpu_elemwise_alloc
)
...
...
theano/sandbox/cuda/tests/test_blas.py
浏览文件 @
b0a20106
...
@@ -67,8 +67,8 @@ class TestBatchedDot(TestCase):
...
@@ -67,8 +67,8 @@ class TestBatchedDot(TestCase):
z_test
=
numpy
.
sum
(
a
[:,:,:,
None
]
*
b
[:,
None
,:,:],
axis
=-
2
)
z_test
=
numpy
.
sum
(
a
[:,:,:,
None
]
*
b
[:,
None
,:,:],
axis
=-
2
)
assert
numpy
.
allclose
(
z0
,
z_test
)
unittest_tools
.
assert_
allclose
(
z0
,
z_test
)
assert
numpy
.
allclose
(
z1
,
z_test
)
unittest_tools
.
assert_
allclose
(
z1
,
z_test
)
cmp
((
5
,
4
,
3
),
(
5
,
3
,
2
))
cmp
((
5
,
4
,
3
),
(
5
,
3
,
2
))
cmp
((
5
,
3
,
3
),
(
5
,
3
,
3
))
cmp
((
5
,
3
,
3
),
(
5
,
3
,
3
))
...
@@ -108,7 +108,7 @@ class TestBatchedDot(TestCase):
...
@@ -108,7 +108,7 @@ class TestBatchedDot(TestCase):
self
.
assertRaises
(
RuntimeError
,
fail
,
(
5
,
4
,
3
),
(
5
,
2
,
2
))
self
.
assertRaises
(
RuntimeError
,
fail
,
(
5
,
4
,
3
),
(
5
,
2
,
2
))
def
test_batched_dot_gradient
(
self
):
def
test_batched_dot_gradient
(
self
):
theano
.
tests
.
unittest_tools
.
verify_grad
(
unittest_tools
.
verify_grad
(
batched_dot
,
batched_dot
,
[
numpy
.
random
.
randn
(
5
,
7
,
2
)
.
astype
(
numpy
.
float32
),
[
numpy
.
random
.
randn
(
5
,
7
,
2
)
.
astype
(
numpy
.
float32
),
numpy
.
random
.
randn
(
5
,
2
,
6
)
.
astype
(
numpy
.
float32
)],
numpy
.
random
.
randn
(
5
,
2
,
6
)
.
astype
(
numpy
.
float32
)],
...
@@ -161,18 +161,18 @@ def test_dot22scalar():
...
@@ -161,18 +161,18 @@ def test_dot22scalar():
[
a
,
b
],
[
a
,
b
],
tensor
.
dot
(
a
,
b
)
*
numpy
.
asarray
(
4
,
'float32'
))
tensor
.
dot
(
a
,
b
)
*
numpy
.
asarray
(
4
,
'float32'
))
t
=
f
.
maker
.
fgraph
.
toposort
()
t
=
f
.
maker
.
fgraph
.
toposort
()
assert
any
([
isinstance
(
n
.
op
,
tcn
.
blas
.
Gpu
Gemm
)
for
n
in
t
])
assert
any
([
isinstance
(
n
.
op
,
tcn
.
blas
.
Gpu
Dot22Scalar
)
for
n
in
t
])
assert
any
([
isinstance
(
n
.
op
,
tcn
.
basic_ops
.
GpuAllocEmpty
)
#
assert any([isinstance(n.op, tcn.basic_ops.GpuAllocEmpty)
for
n
in
t
])
#
for n in t])
assert
numpy
.
allclose
(
f
(
av
,
bv
),
f2
(
av
,
bv
))
assert
numpy
.
allclose
(
f
(
av
,
bv
),
f2
(
av
,
bv
))
f
=
theano
.
function
([
a
,
b
,
scalar
],
tensor
.
dot
(
a
,
b
)
*
scalar
,
f
=
theano
.
function
([
a
,
b
,
scalar
],
tensor
.
dot
(
a
,
b
)
*
scalar
,
mode
=
mode_with_gpu
)
mode
=
mode_with_gpu
)
f2
=
theano
.
function
([
a
,
b
,
scalar
],
tensor
.
dot
(
a
,
b
)
*
scalar
)
f2
=
theano
.
function
([
a
,
b
,
scalar
],
tensor
.
dot
(
a
,
b
)
*
scalar
)
t
=
f
.
maker
.
fgraph
.
toposort
()
t
=
f
.
maker
.
fgraph
.
toposort
()
assert
any
([
isinstance
(
n
.
op
,
tcn
.
blas
.
Gpu
Gemm
)
for
n
in
t
])
assert
any
([
isinstance
(
n
.
op
,
tcn
.
blas
.
Gpu
Dot22Scalar
)
for
n
in
t
])
assert
any
([
isinstance
(
n
.
op
,
tcn
.
basic_ops
.
GpuAllocEmpty
)
#
assert any([isinstance(n.op, tcn.basic_ops.GpuAllocEmpty)
for
n
in
t
])
#
for n in t])
assert
numpy
.
allclose
(
f
(
av
,
bv
,
0.5
),
f2
(
av
,
bv
,
0.5
))
assert
numpy
.
allclose
(
f
(
av
,
bv
,
0.5
),
f2
(
av
,
bv
,
0.5
))
f
=
theano
.
function
([
a
,
b
,
scalar
],
f
=
theano
.
function
([
a
,
b
,
scalar
],
...
...
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
b0a20106
...
@@ -202,13 +202,6 @@ class Test_local_elemwise_alloc(test_opt.Test_local_elemwise_alloc):
...
@@ -202,13 +202,6 @@ class Test_local_elemwise_alloc(test_opt.Test_local_elemwise_alloc):
if
elem
.
op
is
not
None
])
==
count
if
elem
.
op
is
not
None
])
==
count
)
)
def
_verify_assert_count
(
self
,
f
,
count
):
assert
(
sum
([
isinstance
(
elem
.
op
,
tensor
.
opt
.
Assert
)
for
elem
in
f
.
maker
.
fgraph
.
toposort
()
if
elem
.
op
is
not
None
])
==
count
)
def
test_alloc_memset_0
():
def
test_alloc_memset_0
():
i
=
tensor
.
iscalar
()
i
=
tensor
.
iscalar
()
...
...
theano/sandbox/gpuarray/basic_ops.py
浏览文件 @
b0a20106
...
@@ -24,15 +24,13 @@ from .fp16_help import write_w
...
@@ -24,15 +24,13 @@ from .fp16_help import write_w
def
as_gpuarray_variable
(
x
):
def
as_gpuarray_variable
(
x
):
# This is needed to lower the number of useless transfer
if
getattr
(
x
,
'owner'
,
None
):
# introduced during optimization. This speed up optimization and
if
isinstance
(
x
.
owner
.
op
,
HostFromGpu
):
# "canonicalize" the graph, so it make easier making some
# optimization.
if
(
hasattr
(
x
,
'fgraph'
)
and
len
(
x
.
clients
)
==
1
and
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
)):
return
x
.
owner
.
inputs
[
0
]
return
x
.
owner
.
inputs
[
0
]
elif
(
isinstance
(
x
.
owner
.
op
,
GpuFromHost
)
and
x
.
owner
.
inputs
[
0
]
.
owner
and
isinstance
(
x
.
owner
.
inputs
[
0
]
.
owner
.
op
,
HostFromGpu
)):
return
x
.
owner
.
inputs
[
0
]
.
owner
.
inputs
[
0
]
if
hasattr
(
x
,
'_as_GpuArrayVariable'
):
if
hasattr
(
x
,
'_as_GpuArrayVariable'
):
return
x
.
_as_GpuArrayVariable
()
return
x
.
_as_GpuArrayVariable
()
# TODO we need to have the cuda -> gpu path taken care of.
# TODO we need to have the cuda -> gpu path taken care of.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论