Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0a876e23
提交
0a876e23
authored
12月 17, 2015
作者:
mronian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adds test for uint datatype for image_shape and filter_shape in…
Adds test for uint datatype for image_shape and filter_shape in theano.tensor.nnet.conv and also checks if datatype is in tensor.discrete_dtypes
上级
22db3930
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
18 行增加
和
3 行删除
+18
-3
conv.py
theano/tensor/nnet/conv.py
+2
-2
test_conv.py
theano/tensor/nnet/tests/test_conv.py
+16
-1
没有找到文件。
theano/tensor/nnet/conv.py
浏览文件 @
0a876e23
...
...
@@ -108,7 +108,7 @@ def conv2d(input, filters, image_shape=None, filter_shape=None,
" information are constant values. We got"
"
%
s for the image_shape parameter"
%
image_shape
[
i
])
assert
"int"
in
str
(
image_shape
[
i
]
.
dtype
)
assert
image_shape
[
i
]
.
dtype
in
theano
.
tensor
.
discrete_dtypes
image_shape
[
i
]
=
int
(
image_shape
[
i
])
if
filter_shape
is
not
None
:
filter_shape
=
list
(
filter_shape
)
...
...
@@ -123,7 +123,7 @@ def conv2d(input, filters, image_shape=None, filter_shape=None,
" information are constant values. We got"
"
%
s for the filter_shape "
"parameter"
%
filter_shape
[
i
])
assert
"int"
in
str
(
filter_shape
[
i
]
.
dtype
)
assert
filter_shape
[
i
]
.
dtype
in
theano
.
tensor
.
discrete_dtypes
filter_shape
[
i
]
=
int
(
filter_shape
[
i
])
if
image_shape
and
filter_shape
:
...
...
theano/tensor/nnet/tests/test_conv.py
浏览文件 @
0a876e23
...
...
@@ -3,7 +3,6 @@ import time
from
nose.plugins.skip
import
SkipTest
import
numpy
import
theano
import
theano.tensor
as
T
from
theano.tests
import
unittest_tools
as
utt
...
...
@@ -154,6 +153,22 @@ class TestConv2D(utt.InferShapeTester):
self
.
validate
((
3
,
2
,
7
,
5
),
(
5
,
2
,
2
,
3
),
'full'
)
# test filter same size as input
def
test_uint_image_shape_datatype
(
self
):
"""Tests for uint datatype in image_shape.
"""
self
.
validate
((
2
,
2
,
3
,
numpy
.
uint8
(
3
)),
(
3
,
2
,
3
,
3
),
'valid'
,
verify_grad
=
False
)
self
.
validate
((
numpy
.
uint16
(
2
),
2
,
3
,
3
),
(
3
,
2
,
3
,
3
),
'valid'
,
verify_grad
=
False
)
self
.
validate
((
2
,
numpy
.
uint32
(
2
),
3
,
3
),
(
3
,
2
,
3
,
3
),
'valid'
,
verify_grad
=
False
)
def
test_uint_filter_shape_datatype
(
self
):
"""Tests for uint datatype in filter_shape
"""
self
.
validate
((
3
,
2
,
3
,
3
),
(
2
,
2
,
3
,
numpy
.
uint8
(
3
)),
'valid'
,
verify_grad
=
False
)
self
.
validate
((
3
,
2
,
3
,
3
),
(
numpy
.
uint16
(
2
),
2
,
3
,
3
),
'valid'
,
verify_grad
=
False
)
self
.
validate
((
3
,
2
,
3
,
3
),
(
2
,
numpy
.
uint32
(
2
),
3
,
3
),
'valid'
,
verify_grad
=
False
)
def
test_img_kernel_same_shape
(
self
):
self
.
validate
((
3
,
2
,
3
,
3
),
(
4
,
2
,
3
,
3
),
'full'
)
self
.
validate
((
3
,
2
,
3
,
3
),
(
4
,
2
,
3
,
3
),
'valid'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论