Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
17d4842c
提交
17d4842c
authored
2月 17, 2017
作者:
Matt Graham
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding scipy.special modified Bessel function ops.
上级
8fb9d9a7
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
82 行增加
和
0 行删除
+82
-0
basic_scipy.py
theano/scalar/basic_scipy.py
+58
-0
basic.py
theano/tensor/basic.py
+10
-0
inplace.py
theano/tensor/inplace.py
+10
-0
test_basic.py
theano/tensor/tests/test_basic.py
+4
-0
没有找到文件。
theano/scalar/basic_scipy.py
浏览文件 @
17d4842c
...
...
@@ -429,3 +429,61 @@ class J0(UnaryScalarOp):
j0(
%(x)
s);"""
%
locals
()
raise
NotImplementedError
(
'only floating point is implemented'
)
j0
=
J0
(
upgrade_to_float
,
name
=
'j0'
)
class
I1
(
UnaryScalarOp
):
"""
Modified Bessel function of order 1.
"""
@staticmethod
def
st_impl
(
x
):
return
scipy
.
special
.
i1
(
x
)
def
impl
(
self
,
x
):
if
imported_scipy_special
:
return
self
.
st_impl
(
x
)
else
:
super
(
I1
,
self
)
.
impl
(
x
)
def
grad
(
self
,
inp
,
grads
):
raise
NotImplementedError
()
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
x
,
=
inp
z
,
=
out
if
node
.
inputs
[
0
]
.
type
in
float_types
:
return
"""
%(z)
s =
i1(
%(x)
s);"""
%
locals
()
raise
NotImplementedError
(
'only floating point is implemented'
)
i1
=
I1
(
upgrade_to_float
,
name
=
'i1'
)
class
I0
(
UnaryScalarOp
):
"""
Modified Bessel function of order 0.
"""
@staticmethod
def
st_impl
(
x
):
return
scipy
.
special
.
i0
(
x
)
def
impl
(
self
,
x
):
if
imported_scipy_special
:
return
self
.
st_impl
(
x
)
else
:
super
(
I0
,
self
)
.
impl
(
x
)
def
grad
(
self
,
inp
,
grads
):
x
,
=
inp
gz
,
=
grads
return
[
gz
*
i1
(
x
)]
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
x
,
=
inp
z
,
=
out
if
node
.
inputs
[
0
]
.
type
in
float_types
:
return
"""
%(z)
s =
i0(
%(x)
s);"""
%
locals
()
raise
NotImplementedError
(
'only floating point is implemented'
)
i0
=
I0
(
upgrade_to_float
,
name
=
'i0'
)
theano/tensor/basic.py
浏览文件 @
17d4842c
...
...
@@ -2309,6 +2309,16 @@ def j1(a):
"""Bessel function of the 1'th kind"""
@scal_elemwise
def
i0
(
a
):
"""Modified Bessel function of order 0."""
@scal_elemwise
def
i1
(
a
):
"Modified Bessel function of order 1."
@_scal_elemwise
def
real
(
z
):
"""Return real component of complex-valued tensor `z`"""
...
...
theano/tensor/inplace.py
浏览文件 @
17d4842c
...
...
@@ -290,6 +290,16 @@ def j1_inplace(a):
"""Bessel function of the 0'th kind"""
@_scal_inplace
def
i0_inplace
(
a
):
"""Modified Bessel function of order 0."""
@_scal_inplace
def
i1_inplace
(
a
):
"Modified Bessel function of order 1."
@_scal_inplace
def
second_inplace
(
a
):
"""Fill `a` with `b`"""
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
17d4842c
...
...
@@ -1721,6 +1721,8 @@ if imported_scipy_special:
expected_chi2sf
=
scipy
.
stats
.
chi2
.
sf
expected_j0
=
scipy
.
special
.
j0
expected_j1
=
scipy
.
special
.
j1
expected_i0
=
scipy
.
special
.
i0
expected_i1
=
scipy
.
special
.
i1
skip_scipy
=
False
expected_erfcx
=
scipy
.
special
.
erfcx
else
:
...
...
@@ -1735,6 +1737,8 @@ else:
expected_chi2sf
=
[]
expected_j0
=
[]
expected_j1
=
[]
expected_i0
=
[]
expected_i1
=
[]
skip_scipy
=
"scipy is not present"
ErfTester
=
makeBroadcastTester
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论