Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7e74bc31
提交
7e74bc31
authored
8月 07, 2015
作者:
Iban Harlouchet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
numpydoc for theano/sandbox/fourier.py
上级
0a7415d7
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
10 行删除
+15
-10
fourier.py
theano/sandbox/fourier.py
+15
-10
没有找到文件。
theano/sandbox/fourier.py
浏览文件 @
7e74bc31
"""Provides Ops for FFT and DCT.
"""
Provides Ops for FFT and DCT.
"""
"""
import
numpy
import
numpy
...
@@ -23,18 +24,19 @@ grad_todo = GradTodo()
...
@@ -23,18 +24,19 @@ grad_todo = GradTodo()
class
FFT
(
Op
):
class
FFT
(
Op
):
"""Fast Fourier Transform
"""
Fast Fourier Transform.
.. TODO:
.. TODO:
The current implementation just works for matrix inputs, and permits
taking a 1D FFT over
The current implementation just works for matrix inputs, and permits
either rows or columns. Add support for N-D FFTs as provided by either numpy or FFTW
taking a 1D FFT over either rows or columns. Add support for N-D FFTs
directly.
as provided by either numpy or FFTW
directly.
.. TODO:
.. TODO:
Give the C code that uses FFTW.
Give the C code that uses FFTW.
.. TODO:
.. TODO:
u
nit tests.
U
nit tests.
"""
"""
...
@@ -42,7 +44,7 @@ class FFT(Op):
...
@@ -42,7 +44,7 @@ class FFT(Op):
# don't return the plan object in the 'buf' output
# don't return the plan object in the 'buf' output
half
=
False
half
=
False
"""Only return the first half (positive-valued) of the frequency components"""
"""Only return the first half (positive-valued) of the frequency components
.
"""
__props__
=
(
"half"
,
"inverse"
)
__props__
=
(
"half"
,
"inverse"
)
def
__init__
(
self
,
half
=
False
,
inverse
=
False
):
def
__init__
(
self
,
half
=
False
,
inverse
=
False
):
...
@@ -50,7 +52,10 @@ class FFT(Op):
...
@@ -50,7 +52,10 @@ class FFT(Op):
self
.
inverse
=
inverse
self
.
inverse
=
inverse
def
make_node
(
self
,
frames
,
n
,
axis
):
def
make_node
(
self
,
frames
,
n
,
axis
):
""" compute an n-point fft of frames along given axis """
"""
Compute an n-point fft of frames along given axis.
"""
_frames
=
tensor
.
as_tensor
(
frames
,
ndim
=
2
)
_frames
=
tensor
.
as_tensor
(
frames
,
ndim
=
2
)
_n
=
tensor
.
as_tensor
(
n
,
ndim
=
0
)
_n
=
tensor
.
as_tensor
(
n
,
ndim
=
0
)
_axis
=
tensor
.
as_tensor
(
axis
,
ndim
=
0
)
_axis
=
tensor
.
as_tensor
(
axis
,
ndim
=
0
)
...
@@ -103,8 +108,8 @@ def dct_matrix(rows, cols, unitary=True):
...
@@ -103,8 +108,8 @@ def dct_matrix(rows, cols, unitary=True):
"""
"""
Return a (rows x cols) matrix implementing a discrete cosine transform.
Return a (rows x cols) matrix implementing a discrete cosine transform.
This algorithm is adapted from Dan Ellis' Rastmat
This algorithm is adapted from Dan Ellis' Rastmat
spec2cep.m, lines 15-20.
spec2cep.m, lines 15 - 20.
"""
"""
rval
=
numpy
.
zeros
((
rows
,
cols
))
rval
=
numpy
.
zeros
((
rows
,
cols
))
col_range
=
numpy
.
arange
(
cols
)
col_range
=
numpy
.
arange
(
cols
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论