Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
bbcd3418
提交
bbcd3418
authored
1月 10, 2011
作者:
fsavard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Test case for Images2Neibs involving a grad which makes it crash, plus solution (but commented).
上级
3a0282f2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
1 行删除
+15
-1
neighbours.py
theano/sandbox/neighbours.py
+1
-0
test_neighbours.py
theano/sandbox/test_neighbours.py
+14
-1
没有找到文件。
theano/sandbox/neighbours.py
浏览文件 @
bbcd3418
...
...
@@ -233,6 +233,7 @@ def neibs2images(neibs, neib_shape, original_shape):
new_neib_shape
=
T
.
stack
(
original_shape
[
-
1
]
/
neib_shape
[
1
],
neib_shape
[
1
]
)
return
images2neibs
(
neibs
.
dimshuffle
(
'x'
,
'x'
,
0
,
1
),
new_neib_shape
)
.
reshape
(
original_shape
)
#return images2neibs(neibs.reshape((1,1,neibs.shape[0],neibs.shape[1])), new_neib_shape).reshape(original_shape)
# This is work in progress
...
...
theano/sandbox/test_neighbours.py
浏览文件 @
bbcd3418
import
numpy
import
numpy.random
import
theano
from
theano
import
shared
,
function
import
theano.tensor
as
T
...
...
@@ -410,8 +411,20 @@ def test_neibs_grad_verify_grad_warp_centered():
except
NotImplementedError
:
pass
def
test_neibs2images_crash_on_grad
():
# say we had images of size (2,3,20,20)
# then we extracted 2x2 neighbors on this, we get (2*3*10*10, 4)
neibs
=
T
.
dmatrix
()
neibs_val
=
numpy
.
random
.
rand
(
600
,
4
)
to_images
=
T
.
sum
(
neibs2images
(
neibs
,
(
2
,
2
),
(
2
,
3
,
20
,
20
)))
g
=
T
.
grad
(
to_images
,
neibs
)
fn
=
theano
.
function
([
neibs
],
to_images
)
print
"Compiled"
fn
(
neibs_val
)
if
__name__
==
'__main__'
:
#test_neibs_gpu()
#test_neibs()
test_neibs_grad_verify_grad
()
#test_neibs_grad_verify_grad()
test_neibs2images_crash_on_grad
()
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论