Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c77a8a1b
提交
c77a8a1b
authored
5月 24, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add contig version of pow, cos, sin, log, log2, log10
上级
68aad6d2
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
40 行增加
和
0 行删除
+40
-0
basic.py
theano/scalar/basic.py
+40
-0
没有找到文件。
theano/scalar/basic.py
浏览文件 @
c77a8a1b
...
@@ -1649,6 +1649,31 @@ class Pow(BinaryScalarOp):
...
@@ -1649,6 +1649,31 @@ class Pow(BinaryScalarOp):
return
(
first_part
,
second_part
)
return
(
first_part
,
second_part
)
def
c_code_contiguous
(
self
,
node
,
name
,
(
x
,
y
),
(
z
,
),
sub
):
if
(
not
theano
.
config
.
lib
.
amdlibm
or
# We compare the dtype AND the broadcast flag
# as this function do not broadcast
node
.
inputs
[
0
]
.
type
!=
node
.
outputs
[
0
]
.
type
or
node
.
inputs
[
1
]
.
type
!=
node
.
outputs
[
0
]
.
type
):
raise
theano
.
gof
.
utils
.
MethodNotDefined
()
if
node
.
inputs
[
0
]
.
type
==
float32
and
self
.
amd_float32
is
not
None
:
dtype
=
'float'
fct
=
"amd_vrsa_powf"
# amdlibm 3.0 do not have a float64 version of this SIMD function
#elif node.inputs[0].type == float64 and self.amd_float64 is not None:
# dtype = 'double'
# fct = self.amd_float64
else
:
raise
theano
.
gof
.
utils
.
MethodNotDefined
()
return
"""
npy_intp n = PyArray_SIZE(
%(z)
s);
%(dtype)
s * x = (
%(dtype)
s*) PyArray_DATA(
%(x)
s);
%(dtype)
s * y = (
%(dtype)
s*) PyArray_DATA(
%(y)
s);
%(dtype)
s * z = (
%(dtype)
s*) PyArray_DATA(
%(z)
s);
%(fct)
s(n, x, y, z);
"""
%
locals
()
pow
=
Pow
(
upcast_out
,
name
=
'pow'
)
pow
=
Pow
(
upcast_out
,
name
=
'pow'
)
...
@@ -2053,6 +2078,9 @@ inv = Inv(upgrade_to_float, name='inv')
...
@@ -2053,6 +2078,9 @@ inv = Inv(upgrade_to_float, name='inv')
class
Log
(
UnaryScalarOp
):
class
Log
(
UnaryScalarOp
):
""" log base e """
""" log base e """
amd_float32
=
"amd_vrsa_logf"
amd_float64
=
"amd_vrda_log"
def
impl
(
self
,
x
):
def
impl
(
self
,
x
):
return
numpy
.
log
(
x
)
return
numpy
.
log
(
x
)
...
@@ -2076,6 +2104,9 @@ log = Log(upgrade_to_float, name='log')
...
@@ -2076,6 +2104,9 @@ log = Log(upgrade_to_float, name='log')
class
Log2
(
UnaryScalarOp
):
class
Log2
(
UnaryScalarOp
):
""" log base 2 """
""" log base 2 """
amd_float32
=
"amd_vrsa_log2f"
amd_float64
=
"amd_vrda_log2"
def
impl
(
self
,
x
):
def
impl
(
self
,
x
):
return
numpy
.
log2
(
x
)
return
numpy
.
log2
(
x
)
...
@@ -2096,6 +2127,9 @@ log2 = Log2(upgrade_to_float, name='log2')
...
@@ -2096,6 +2127,9 @@ log2 = Log2(upgrade_to_float, name='log2')
class
Log10
(
UnaryScalarOp
):
class
Log10
(
UnaryScalarOp
):
""" log base 10 """
""" log base 10 """
amd_float32
=
"amd_vrsa_log10f"
amd_float64
=
"amd_vrda_log10"
def
impl
(
self
,
x
):
def
impl
(
self
,
x
):
return
numpy
.
log10
(
x
)
return
numpy
.
log10
(
x
)
...
@@ -2268,6 +2302,9 @@ rad2deg = Rad2Deg(upgrade_to_float, name='rad2deg')
...
@@ -2268,6 +2302,9 @@ rad2deg = Rad2Deg(upgrade_to_float, name='rad2deg')
class
Cos
(
UnaryScalarOp
):
class
Cos
(
UnaryScalarOp
):
amd_float32
=
"amd_vrsa_cosf"
amd_float64
=
"amd_vrda_cos"
def
impl
(
self
,
x
):
def
impl
(
self
,
x
):
return
numpy
.
cos
(
x
)
return
numpy
.
cos
(
x
)
...
@@ -2306,6 +2343,9 @@ arccos = ArcCos(upgrade_to_float, name='arccos')
...
@@ -2306,6 +2343,9 @@ arccos = ArcCos(upgrade_to_float, name='arccos')
class
Sin
(
UnaryScalarOp
):
class
Sin
(
UnaryScalarOp
):
amd_float32
=
"amd_vrsa_sinf"
amd_float64
=
"amd_vrda_sin"
def
impl
(
self
,
x
):
def
impl
(
self
,
x
):
return
numpy
.
sin
(
x
)
return
numpy
.
sin
(
x
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论