Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5b6dd257
提交
5b6dd257
authored
1月 27, 2015
作者:
Dustin Webb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Registered local_elemwise_alloc for the GPU and created tests.
上级
27dd85e9
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
107 行增加
和
2 行删除
+107
-2
opt.py
theano/sandbox/cuda/opt.py
+1
-0
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+106
-2
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
5b6dd257
...
@@ -1814,6 +1814,7 @@ gpu_inplace_elemwise_optimizer = tensor.opt.inplace_elemwise_optimizer_op(
...
@@ -1814,6 +1814,7 @@ gpu_inplace_elemwise_optimizer = tensor.opt.inplace_elemwise_optimizer_op(
optdb
.
register
(
'gpu_inplace_elemwise_opt'
,
gpu_inplace_elemwise_optimizer
,
75
,
optdb
.
register
(
'gpu_inplace_elemwise_opt'
,
gpu_inplace_elemwise_optimizer
,
75
,
'fast_run'
,
'inplace'
,
'gpu_inplace'
)
'fast_run'
,
'inplace'
,
'gpu_inplace'
)
tensor
.
opt
.
register_specialize_device
(
tensor
.
opt
.
local_shape_to_shape_i
)
gpu_elemwise_alloc
=
gof
.
local_optimizer
([
GpuElemwise
])(
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
)
)
)
...
...
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
5b6dd257
...
@@ -129,7 +129,6 @@ class Test_local_elemwise_alloc(unittest.TestCase):
...
@@ -129,7 +129,6 @@ class Test_local_elemwise_alloc(unittest.TestCase):
self
.
alloc_wo_dep
+
self
.
mat
,
self
.
alloc_wo_dep
+
self
.
mat
,
mode
=
mode_with_gpu
mode
=
mode_with_gpu
)
)
import
ipdb
;
ipdb
.
set_trace
()
self
.
_verify_alloc_count
(
func
,
0
)
self
.
_verify_alloc_count
(
func
,
0
)
self
.
_verify_assert_count
(
func
,
1
)
self
.
_verify_assert_count
(
func
,
1
)
...
@@ -143,14 +142,119 @@ class Test_local_elemwise_alloc(unittest.TestCase):
...
@@ -143,14 +142,119 @@ class Test_local_elemwise_alloc(unittest.TestCase):
self
.
_verify_assert_count
(
func
,
0
)
self
.
_verify_assert_count
(
func
,
0
)
# Optimization on alloc without assert
# Optimization on alloc without assert
temp_val
=
theano
.
config
.
experimental
.
local_alloc_elemwise_assert
theano
.
config
.
experimental
.
local_alloc_elemwise_assert
=
False
func
=
theano
.
function
(
func
=
theano
.
function
(
[
self
.
vec
,
self
.
mat
],
[
self
.
vec
,
self
.
mat
],
self
.
alloc_w_dep
+
self
.
mat
,
self
.
alloc_w_dep
+
self
.
mat
,
mode
=
mode_with_gpu
mode
=
mode_with_gpu
)
)
import
ipdb
;
ipdb
.
set_trace
()
self
.
_verify_alloc_count
(
func
,
0
)
self
.
_verify_alloc_count
(
func
,
0
)
self
.
_verify_assert_count
(
func
,
0
)
self
.
_verify_assert_count
(
func
,
0
)
theano
.
config
.
experimental
.
local_alloc_elemwise_assert
=
temp_val
def
test_remove_alloc_w_dimshuffle
(
self
):
# No optimization on dimshuffle with assert
func
=
theano
.
function
(
[
self
.
vec
,
self
.
mat
],
self
.
alloc_wo_dep
.
dimshuffle
(
0
,
'x'
)
+
self
.
mat
,
mode
=
'FAST_COMPILE'
)
self
.
_verify_alloc_count
(
func
,
1
)
self
.
_verify_assert_count
(
func
,
0
)
# Optimization on dimshuffle with assert
func
=
theano
.
function
(
[
self
.
vec
,
self
.
mat
],
self
.
alloc_wo_dep
.
dimshuffle
(
0
,
'x'
)
+
self
.
mat
,
mode
=
mode_with_gpu
)
self
.
_verify_alloc_count
(
func
,
0
)
self
.
_verify_assert_count
(
func
,
1
)
# No optimization on dimshuffle without assert
func
=
theano
.
function
(
[
self
.
vec
,
self
.
mat
],
self
.
alloc_w_dep
.
dimshuffle
(
0
,
'x'
)
+
self
.
mat
,
mode
=
'FAST_COMPILE'
)
self
.
_verify_alloc_count
(
func
,
1
)
self
.
_verify_assert_count
(
func
,
0
)
# Optimization on dimshuffle without assert
temp_val
=
theano
.
config
.
experimental
.
local_alloc_elemwise_assert
theano
.
config
.
experimental
.
local_alloc_elemwise_assert
=
False
func
=
theano
.
function
(
[
self
.
vec
,
self
.
mat
],
self
.
alloc_w_dep
+
self
.
mat
,
mode
=
mode_with_gpu
)
self
.
_verify_alloc_count
(
func
,
0
)
self
.
_verify_assert_count
(
func
,
0
)
theano
.
config
.
experimental
.
local_alloc_elemwise_assert
=
temp_val
def
test_multi_input_single_alloc
(
self
):
# No optimization on dimshuffle with assert
tv
=
basic_ops
.
gpu_alloc
(
self
.
vec
,
5
)
tm
=
basic_ops
.
gpu_alloc
(
self
.
mat
,
5
,
5
)
func
=
theano
.
function
(
[
self
.
vec
,
self
.
mat
],
tv
+
tm
,
mode
=
'FAST_COMPILE'
)
self
.
_verify_alloc_count
(
func
,
2
)
self
.
_verify_assert_count
(
func
,
0
)
# Optimization on dimshuffle with assert
func
=
theano
.
function
(
[
self
.
vec
,
self
.
mat
],
tv
+
tm
,
mode
=
mode_with_gpu
)
self
.
_verify_alloc_count
(
func
,
1
)
self
.
_verify_assert_count
(
func
,
1
)
# No optimization on dimshuffle without assert
s
=
tensor
.
iscalar
(
's'
)
#tv = tensor.alloc(self.vec, s, s)
#tm = tensor.alloc(self.mat, 5, 5, 5)
tv
=
basic_ops
.
gpu_alloc
(
self
.
vec
,
s
)
tm
=
basic_ops
.
gpu_alloc
(
self
.
mat
,
5
,
5
)
func
=
theano
.
function
(
[
self
.
vec
,
self
.
mat
,
s
],
tv
+
tm
,
mode
=
'FAST_COMPILE'
)
self
.
_verify_alloc_count
(
func
,
2
)
self
.
_verify_assert_count
(
func
,
0
)
# Optimization on dimshuffle without assert
temp_val
=
theano
.
config
.
experimental
.
local_alloc_elemwise_assert
theano
.
config
.
experimental
.
local_alloc_elemwise_assert
=
False
func
=
theano
.
function
(
[
self
.
vec
,
self
.
mat
,
s
],
tv
+
tm
,
mode
=
mode_with_gpu
)
self
.
_verify_alloc_count
(
func
,
1
)
self
.
_verify_assert_count
(
func
,
0
)
theano
.
config
.
experimental
.
local_alloc_elemwise_assert
=
temp_val
def
test_error
(
self
):
t3fft
=
theano
.
tensor
.
tensor
(
dtype
=
self
.
dtype
,
broadcastable
=
(
False
,
False
,
True
))
row
=
theano
.
tensor
.
row
(
dtype
=
self
.
dtype
)
o
=
basic_ops
.
gpu_alloc
(
row
,
5
,
5
)
.
dimshuffle
(
0
,
1
,
'x'
)
+
t3fft
func
=
theano
.
function
(
[
t3fft
,
row
],
o
,
mode
=
mode_with_gpu
)
self
.
_verify_alloc_count
(
func
,
0
)
self
.
_verify_assert_count
(
func
,
1
)
d
=
numpy
.
random
.
rand
(
5
,
5
,
1
)
.
astype
(
self
.
dtype
)
r
=
numpy
.
random
.
rand
(
1
,
5
)
.
astype
(
self
.
dtype
)
func
(
d
,
r
)
def
test_alloc_memset_0
():
def
test_alloc_memset_0
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论