Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3327d4ad
提交
3327d4ad
authored
6月 27, 2012
作者:
Nicolas Bouchard
提交者:
Frederic
7月 06, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add BinomialTester.
上级
12955fcf
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
41 行增加
和
2 行删除
+41
-2
sp2.py
theano/sparse/sandbox/sp2.py
+1
-1
test_sp2.py
theano/sparse/tests/test_sp2.py
+40
-1
没有找到文件。
theano/sparse/sandbox/sp2.py
浏览文件 @
3327d4ad
...
@@ -689,7 +689,7 @@ class Binomial(gof.op.Op):
...
@@ -689,7 +689,7 @@ class Binomial(gof.op.Op):
return
None
,
None
,
None
return
None
,
None
,
None
def
infer_shape
(
self
,
node
,
ins_shapes
):
def
infer_shape
(
self
,
node
,
ins_shapes
):
return
[
ins_shapes
[
2
]
]
return
[
(
node
.
inputs
[
2
][
0
],
node
.
inputs
[
2
][
1
])
]
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
__class__
.
__name__
return
self
.
__class__
.
__name__
...
...
theano/sparse/tests/test_sp2.py
浏览文件 @
3327d4ad
...
@@ -325,6 +325,46 @@ class MultinomialTester(utt.InferShapeTester):
...
@@ -325,6 +325,46 @@ class MultinomialTester(utt.InferShapeTester):
self
.
op_class
)
self
.
op_class
)
class
BinomialTester
(
utt
.
InferShapeTester
):
n
=
tensor
.
scalar
()
p
=
tensor
.
scalar
()
shape
=
tensor
.
lvector
()
_n
=
5
_p
=
.
25
_shape
=
np
.
asarray
([
3
,
5
],
dtype
=
'int64'
)
inputs
=
[
n
,
p
,
shape
]
_inputs
=
[
_n
,
_p
,
_shape
]
def
setUp
(
self
):
super
(
BinomialTester
,
self
)
.
setUp
()
self
.
op_class
=
S2
.
Binomial
def
test_op
(
self
):
for
sp_format
in
sparse
.
sparse_formats
:
for
o_type
in
sparse
.
float_dtypes
:
f
=
theano
.
function
(
self
.
inputs
,
S2
.
Binomial
(
sp_format
,
o_type
)(
*
self
.
inputs
))
tested
=
f
(
*
self
.
_inputs
)
assert
tested
.
shape
==
tuple
(
self
.
_shape
)
assert
tested
.
format
==
sp_format
assert
tested
.
dtype
==
o_type
assert
np
.
allclose
(
np
.
floor
(
tested
.
todense
()),
tested
.
todense
())
def
test_infer_shape
(
self
):
for
sp_format
in
sparse
.
sparse_formats
:
for
o_type
in
sparse
.
float_dtypes
:
self
.
_compile_and_check
(
self
.
inputs
,
[
S2
.
Binomial
(
sp_format
,
o_type
)(
*
self
.
inputs
)],
self
.
_inputs
,
self
.
op_class
)
class
_StructuredMonoidUnaryTester
(
unittest
.
TestCase
):
class
_StructuredMonoidUnaryTester
(
unittest
.
TestCase
):
def
test_op
(
self
):
def
test_op
(
self
):
for
format
in
sparse
.
sparse_formats
:
for
format
in
sparse
.
sparse_formats
:
...
@@ -472,7 +512,6 @@ class SamplingDotTester(utt.InferShapeTester):
...
@@ -472,7 +512,6 @@ class SamplingDotTester(utt.InferShapeTester):
for
maximum
in
[
5
,
5
,
2
]]
for
maximum
in
[
5
,
5
,
2
]]
a
[
2
]
=
sp
.
csr_matrix
(
a
[
2
])
a
[
2
]
=
sp
.
csr_matrix
(
a
[
2
])
def
setUp
(
self
):
def
setUp
(
self
):
super
(
SamplingDotTester
,
self
)
.
setUp
()
super
(
SamplingDotTester
,
self
)
.
setUp
()
self
.
op_class
=
S2
.
SamplingDot
self
.
op_class
=
S2
.
SamplingDot
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论