Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d268d4b9
提交
d268d4b9
authored
6月 08, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
moved new fft tests to the right file.
上级
d5790ad1
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
69 行增加
和
72 行删除
+69
-72
fourier.py
theano/tensor/fourier.py
+0
-72
test_fourier.py
theano/tensor/tests/test_fourier.py
+69
-0
没有找到文件。
theano/tensor/fourier.py
浏览文件 @
d268d4b9
...
@@ -3,7 +3,6 @@ import numpy
...
@@ -3,7 +3,6 @@ import numpy
import
math
import
math
from
theano
import
gof
,
tensor
,
function
,
scalar
from
theano
import
gof
,
tensor
,
function
,
scalar
from
theano.sandbox.linalg.ops
import
diag
from
theano.sandbox.linalg.ops
import
diag
from
theano.tests
import
unittest_tools
as
utt
class
Fourier
(
gof
.
Op
):
class
Fourier
(
gof
.
Op
):
...
@@ -150,74 +149,3 @@ class Fourier(gof.Op):
...
@@ -150,74 +149,3 @@ class Fourier(gof.Op):
fft
=
Fourier
()
fft
=
Fourier
()
import
numpy
from
theano
import
tensor
,
function
,
scalar
from
theano.sandbox.linalg.ops
import
diag
from
theano.tests
import
unittest_tools
as
utt
#from theano import Fourier fft
class
TestFourier
(
utt
.
InferShapeTester
):
rng
=
numpy
.
random
.
RandomState
(
43
)
def
setUp
(
self
):
super
(
TestFourier
,
self
)
.
setUp
()
self
.
op_class
=
Fourier
self
.
op
=
fft
def
test_perform
(
self
):
a
=
tensor
.
dmatrix
()
f
=
function
([
a
],
self
.
op
(
a
,
n
=
10
,
axis
=
0
))
a
=
numpy
.
random
.
rand
(
8
,
6
)
assert
numpy
.
allclose
(
f
(
a
),
numpy
.
fft
.
fft
(
a
,
10
,
0
))
def
test_infer_shape
(
self
):
a
=
tensor
.
dvector
()
self
.
_compile_and_check
([
a
],
[
self
.
op
(
a
,
16
,
0
)],
[
numpy
.
random
.
rand
(
12
)],
self
.
op_class
)
a
=
tensor
.
dmatrix
()
for
var
in
[
self
.
op
(
a
,
16
,
1
),
self
.
op
(
a
,
None
,
1
),
self
.
op
(
a
,
16
,
None
),
self
.
op
(
a
,
None
,
None
)]:
self
.
_compile_and_check
([
a
],
[
var
],
[
numpy
.
random
.
rand
(
12
,
4
)],
self
.
op_class
)
b
=
tensor
.
iscalar
()
for
var
in
[
self
.
op
(
a
,
16
,
b
),
self
.
op
(
a
,
None
,
b
)]:
self
.
_compile_and_check
([
a
,
b
],
[
var
],
[
numpy
.
random
.
rand
(
12
,
4
),
0
],
self
.
op_class
)
def
test_gradient
(
self
):
def
fft_test1
(
a
):
return
self
.
op
(
a
,
None
,
None
)
def
fft_test2
(
a
):
return
self
.
op
(
a
,
None
,
0
)
def
fft_test3
(
a
):
return
self
.
op
(
a
,
4
,
None
)
def
fft_test4
(
a
):
return
self
.
op
(
a
,
4
,
0
)
pts
=
[
numpy
.
random
.
rand
(
5
,
2
,
4
,
3
),
numpy
.
random
.
rand
(
2
,
3
,
4
),
numpy
.
random
.
rand
(
2
,
5
),
numpy
.
random
.
rand
(
5
)]
for
fft_test
in
[
fft_test1
,
fft_test2
,
fft_test3
,
fft_test4
]:
for
pt
in
pts
:
theano
.
gradient
.
verify_grad
(
fft_test
,
[
pt
],
n_tests
=
1
,
rng
=
TestFourier
.
rng
,
out_type
=
'complex64'
)
if
__name__
==
"__main__"
:
t
=
TestFourier
(
'setUp'
)
t
.
setUp
()
t
.
test_perform
()
t
.
test_infer_shape
()
t
.
test_gradient
()
theano/tensor/tests/test_fourier.py
0 → 100644
浏览文件 @
d268d4b9
import
numpy
import
theano
from
theano
import
tensor
from
theano.tests
import
unittest_tools
as
utt
from
theano.tensor.fourier
import
Fourier
,
fft
class
TestFourier
(
utt
.
InferShapeTester
):
rng
=
numpy
.
random
.
RandomState
(
43
)
def
setUp
(
self
):
super
(
TestFourier
,
self
)
.
setUp
()
self
.
op_class
=
Fourier
self
.
op
=
fft
def
test_perform
(
self
):
a
=
tensor
.
dmatrix
()
f
=
theano
.
function
([
a
],
self
.
op
(
a
,
n
=
10
,
axis
=
0
))
a
=
numpy
.
random
.
rand
(
8
,
6
)
assert
numpy
.
allclose
(
f
(
a
),
numpy
.
fft
.
fft
(
a
,
10
,
0
))
def
test_infer_shape
(
self
):
a
=
tensor
.
dvector
()
self
.
_compile_and_check
([
a
],
[
self
.
op
(
a
,
16
,
0
)],
[
numpy
.
random
.
rand
(
12
)],
self
.
op_class
)
a
=
tensor
.
dmatrix
()
for
var
in
[
self
.
op
(
a
,
16
,
1
),
self
.
op
(
a
,
None
,
1
),
self
.
op
(
a
,
16
,
None
),
self
.
op
(
a
,
None
,
None
)]:
self
.
_compile_and_check
([
a
],
[
var
],
[
numpy
.
random
.
rand
(
12
,
4
)],
self
.
op_class
)
b
=
tensor
.
iscalar
()
for
var
in
[
self
.
op
(
a
,
16
,
b
),
self
.
op
(
a
,
None
,
b
)]:
self
.
_compile_and_check
([
a
,
b
],
[
var
],
[
numpy
.
random
.
rand
(
12
,
4
),
0
],
self
.
op_class
)
def
test_gradient
(
self
):
def
fft_test1
(
a
):
return
self
.
op
(
a
,
None
,
None
)
def
fft_test2
(
a
):
return
self
.
op
(
a
,
None
,
0
)
def
fft_test3
(
a
):
return
self
.
op
(
a
,
4
,
None
)
def
fft_test4
(
a
):
return
self
.
op
(
a
,
4
,
0
)
pts
=
[
numpy
.
random
.
rand
(
5
,
2
,
4
,
3
),
numpy
.
random
.
rand
(
2
,
3
,
4
),
numpy
.
random
.
rand
(
2
,
5
),
numpy
.
random
.
rand
(
5
)]
for
fft_test
in
[
fft_test1
,
fft_test2
,
fft_test3
,
fft_test4
]:
for
pt
in
pts
:
theano
.
gradient
.
verify_grad
(
fft_test
,
[
pt
],
n_tests
=
1
,
rng
=
TestFourier
.
rng
,
out_type
=
'complex64'
)
if
__name__
==
"__main__"
:
t
=
TestFourier
(
'setUp'
)
t
.
setUp
()
t
.
test_perform
()
t
.
test_infer_shape
()
t
.
test_gradient
()
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论