Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
923b04d6
提交
923b04d6
authored
11月 23, 2016
作者:
Zhouhan LIN
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adjust according to comments
上级
066a4e31
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
6 行增加
和
6 行删除
+6
-6
subtensor.py
theano/gpuarray/subtensor.py
+2
-2
test_subtensor.py
theano/gpuarray/tests/test_subtensor.py
+4
-4
没有找到文件。
theano/gpuarray/subtensor.py
浏览文件 @
923b04d6
...
@@ -8,7 +8,8 @@ from six.moves import StringIO
...
@@ -8,7 +8,8 @@ from six.moves import StringIO
from
theano
import
tensor
,
gof
,
Op
from
theano
import
tensor
,
gof
,
Op
from
theano.gradient
import
grad_not_implemented
from
theano.gradient
import
grad_not_implemented
import
theano.tensor.clip
,
theano
.
tensor
.
minimum
import
theano.tensor.clip
import
theano.tensor.minimum
from
theano.tensor.subtensor
import
IncSubtensor
,
Subtensor
,
get_idx_list
from
theano.tensor.subtensor
import
IncSubtensor
,
Subtensor
,
get_idx_list
try
:
try
:
...
@@ -1149,7 +1150,6 @@ class GpuDiagonal(Subtensor):
...
@@ -1149,7 +1150,6 @@ class GpuDiagonal(Subtensor):
new_dim_order
=
tuple
(
new_dim_order
[:
stride_axis
]
+
new_dim_order
=
tuple
(
new_dim_order
[:
stride_axis
]
+
new_dim_order
[
stride_axis
+
1
:]
+
new_dim_order
[
stride_axis
+
1
:]
+
[
stride_axis
,
])
[
stride_axis
,
])
# rval = cuda_ndarray.cuda_ndarray.dimshuffle(x[slicer], new_dim_order)
rval
=
x
[
slicer
]
.
transpose
(
new_dim_order
)
rval
=
x
[
slicer
]
.
transpose
(
new_dim_order
)
# step 3) modify the strides in the last axis, such that rval becomes
# step 3) modify the strides in the last axis, such that rval becomes
...
...
theano/gpuarray/tests/test_subtensor.py
浏览文件 @
923b04d6
...
@@ -16,7 +16,7 @@ from ..subtensor import (GpuIncSubtensor, GpuSubtensor,
...
@@ -16,7 +16,7 @@ from ..subtensor import (GpuIncSubtensor, GpuSubtensor,
GpuDiagonal
)
GpuDiagonal
)
from
..type
import
gpuarray_shared_constructor
from
..type
import
gpuarray_shared_constructor
from
.config
import
mode_with_gpu
from
.config
import
mode_with_gpu
,
floatX
class
G_subtensor
(
test_subtensor
.
T_subtensor
):
class
G_subtensor
(
test_subtensor
.
T_subtensor
):
...
@@ -132,7 +132,7 @@ def test_adv_subtensor():
...
@@ -132,7 +132,7 @@ def test_adv_subtensor():
class
test_gpudiagonal
(
unittest
.
TestCase
):
class
test_gpudiagonal
(
unittest
.
TestCase
):
def
test_matrix
(
self
):
def
test_matrix
(
self
):
x
=
cuda
.
fmatrix
()
x
=
tensor
.
fmatrix
()
np_x
=
numpy
.
arange
(
77
)
.
reshape
(
7
,
11
)
.
astype
(
'float32'
)
np_x
=
numpy
.
arange
(
77
)
.
reshape
(
7
,
11
)
.
astype
(
'float32'
)
fn
=
theano
.
function
([
x
],
GpuDiagonal
()(
x
),
mode
=
mode_with_gpu
)
fn
=
theano
.
function
([
x
],
GpuDiagonal
()(
x
),
mode
=
mode_with_gpu
)
assert
numpy
.
allclose
(
fn
(
np_x
),
np_x
.
diagonal
())
assert
numpy
.
allclose
(
fn
(
np_x
),
np_x
.
diagonal
())
...
@@ -142,8 +142,8 @@ class test_gpudiagonal(unittest.TestCase):
...
@@ -142,8 +142,8 @@ class test_gpudiagonal(unittest.TestCase):
assert
numpy
.
allclose
(
fn
(
np_x
),
np_x
.
diagonal
(
-
3
))
assert
numpy
.
allclose
(
fn
(
np_x
),
np_x
.
diagonal
(
-
3
))
def
test_tensor
(
self
):
def
test_tensor
(
self
):
x
=
t
heano
.
t
ensor
.
ftensor4
()
x
=
tensor
.
ftensor4
()
np_x
=
numpy
.
arange
(
30107
)
.
reshape
(
7
,
11
,
17
,
23
)
.
astype
(
'float32'
)
np_x
=
numpy
.
arange
(
30107
)
.
reshape
(
7
,
11
,
17
,
23
)
.
astype
(
floatX
)
for
offset
,
axis1
,
axis2
in
[
for
offset
,
axis1
,
axis2
in
[
(
1
,
0
,
1
),
(
-
1
,
0
,
1
),
(
0
,
1
,
0
),
(
-
2
,
1
,
0
),
(
1
,
0
,
1
),
(
-
1
,
0
,
1
),
(
0
,
1
,
0
),
(
-
2
,
1
,
0
),
(
-
3
,
1
,
0
),
(
-
2
,
2
,
0
),
(
3
,
3
,
0
),
(
-
1
,
3
,
2
),
(
-
3
,
1
,
0
),
(
-
2
,
2
,
0
),
(
3
,
3
,
0
),
(
-
1
,
3
,
2
),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论