Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4855e5b1
提交
4855e5b1
authored
1月 23, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make some ger test run on the gpu.
上级
659a7465
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
35 行增加
和
6 行删除
+35
-6
test_blas.py
theano/sandbox/cuda/tests/test_blas.py
+23
-1
test_blas.py
theano/tensor/tests/test_blas.py
+12
-5
没有找到文件。
theano/sandbox/cuda/tests/test_blas.py
浏览文件 @
4855e5b1
...
...
@@ -17,8 +17,9 @@ import theano.sandbox.cuda as tcn
from
theano.tensor.signal.downsample
import
DownsampleFactorMax
,
DownsampleFactorMaxGrad
import
theano.compile.mode
from
theano.tensor.tests.test_blas
import
BaseGemv
from
theano.tensor.tests.test_blas
import
BaseGemv
,
TestGer_local_gemm_to_ger
from
theano.sandbox.cuda.blas
import
gpu_gemv_no_inplace
,
gpu_gemv_inplace
from
theano.sandbox.cuda.blas
import
gpu_ger_inplace
,
gpu_ger_no_inplace
if
theano
.
config
.
mode
==
'FAST_COMPILE'
:
...
...
@@ -258,3 +259,24 @@ class TestGpuGemv(TestCase, BaseGemv,
# the gemv inplace.
gemv
=
gpu_gemv_inplace
gemv_inplace
=
gpu_gemv_inplace
class
TestGpuGer
(
TestGer_local_gemm_to_ger
):
def
setUp
(
self
):
self
.
mode
=
theano
.
compile
.
get_default_mode
()
.
including
(
'fast_run'
,
'gpu'
)
self
.
mode
=
self
.
mode
.
excluding
(
'c_blas'
)
dtype
=
self
.
dtype
=
'float32'
# optimization isn't dtype-dependent
self
.
A
=
tensor
.
tensor
(
dtype
=
dtype
,
broadcastable
=
(
False
,
False
))
self
.
a
=
tensor
.
tensor
(
dtype
=
dtype
,
broadcastable
=
())
self
.
x
=
tensor
.
tensor
(
dtype
=
dtype
,
broadcastable
=
(
False
,))
self
.
y
=
tensor
.
tensor
(
dtype
=
dtype
,
broadcastable
=
(
False
,))
self
.
origval
=
theano
.
tensor
.
blas_scipy
.
optimizations_enabled
theano
.
tensor
.
blas_scipy
.
optimizations_enabled
=
False
self
.
ger
=
gpu_ger_no_inplace
self
.
ger_destructive
=
gpu_ger_inplace
self
.
gemm
=
tcn
.
blas
.
gpu_gemm_no_inplace
# data on the gpu make the op always inplace
self
.
ger
=
gpu_ger_inplace
self
.
gemm
=
tcn
.
blas
.
gpu_gemm_inplace
theano/tensor/tests/test_blas.py
浏览文件 @
4855e5b1
...
...
@@ -1403,6 +1403,9 @@ class TestGer_local_gemm_to_ger(TestCase, unittest_tools.TestOptimizationMixin):
self
.
y
=
T
.
tensor
(
dtype
=
dtype
,
broadcastable
=
(
False
,))
self
.
origval
=
theano
.
tensor
.
blas_scipy
.
optimizations_enabled
theano
.
tensor
.
blas_scipy
.
optimizations_enabled
=
False
self
.
ger
=
ger
self
.
ger_destructive
=
ger_destructive
self
.
gemm
=
gemm_no_inplace
def
tearDown
(
self
):
theano
.
tensor
.
blas_scipy
.
optimizations_enabled
=
self
.
origval
...
...
@@ -1431,19 +1434,23 @@ class TestGer_local_gemm_to_ger(TestCase, unittest_tools.TestOptimizationMixin):
def
test_outer
(
self
):
f
=
self
.
function
([
self
.
x
,
self
.
y
],
T
.
outer
(
self
.
x
,
self
.
y
))
self
.
assertFunctionContains
(
f
,
ger_destructive
)
self
.
assertFunctionContains
(
f
,
self
.
ger_destructive
)
def
test_A_plus_outer
(
self
):
f
=
self
.
function
([
self
.
A
,
self
.
x
,
self
.
y
],
self
.
A
+
T
.
outer
(
self
.
x
,
self
.
y
))
self
.
assertFunctionContains
(
f
,
ger
)
self
.
assertFunctionContains
(
f
,
self
.
ger
)
def
test_A_plus_scaled_outer
(
self
):
f
=
self
.
function
([
self
.
A
,
self
.
x
,
self
.
y
],
self
.
A
+
0.1
*
T
.
outer
(
self
.
x
,
self
.
y
))
self
.
assertFunctionContains
(
f
,
ger
)
self
.
assertFunctionContains
(
f
,
self
.
ger
)
def
test_scaled_A_plus_scaled_outer
(
self
):
f
=
self
.
function
([
self
.
A
,
self
.
x
,
self
.
y
],
0.2
*
self
.
A
+
0.1
*
T
.
outer
(
self
.
x
,
self
.
y
))
self
.
assertFunctionContains
(
f
,
gemm_no_inplace
)
numpy
.
asarray
(
0.2
,
self
.
dtype
)
*
self
.
A
+
numpy
.
asarray
(
0.1
,
self
.
dtype
)
*
T
.
outer
(
self
.
x
,
self
.
y
))
# Why gemm? This make the graph simpler did we test that it
# make it faster?
self
.
assertFunctionContains
(
f
,
self
.
gemm
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论