Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
40ca10ee
提交
40ca10ee
authored
5月 24, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add amdlibm code for powx (pow(tensor, scalar))
上级
c77a8a1b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
34 行增加
和
17 行删除
+34
-17
basic.py
theano/scalar/basic.py
+34
-17
没有找到文件。
theano/scalar/basic.py
浏览文件 @
40ca10ee
...
...
@@ -850,8 +850,11 @@ class ScalarOp(Op):
outputs are c_contiguous. This allow to use SIMD version
of this op.
The inputs are the same as c_code EXCEPT that inp and out MUST
be the variable name of the ndarray, not the current element.
The inputs are the same as c_code except:
- inp and out must be the variable name of the ndarray
- node must be the elemwise node. This is needed to know
the inputs/outputs type.
"""
raise
theano
.
gof
.
utils
.
MethodNotDefined
()
...
...
@@ -869,10 +872,11 @@ class UnaryScalarOp(ScalarOp):
node
.
inputs
[
0
]
.
type
!=
node
.
outputs
[
0
]
.
type
):
raise
theano
.
gof
.
utils
.
MethodNotDefined
()
if
node
.
inputs
[
0
]
.
type
==
float32
and
self
.
amd_float32
is
not
None
:
dtype
=
node
.
inputs
[
0
]
.
dtype
if
dtype
==
'float32'
and
self
.
amd_float32
is
not
None
:
dtype
=
'float'
fct
=
self
.
amd_float32
elif
node
.
inputs
[
0
]
.
type
==
float64
and
self
.
amd_float64
is
not
None
:
elif
dtype
==
'float64'
and
self
.
amd_float64
is
not
None
:
dtype
=
'double'
fct
=
self
.
amd_float64
else
:
...
...
@@ -1650,29 +1654,42 @@ class Pow(BinaryScalarOp):
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
):
if
not
theano
.
config
.
lib
.
amdlibm
:
raise
theano
.
gof
.
utils
.
MethodNotDefined
()
if
node
.
inputs
[
0
]
.
type
==
float32
and
self
.
amd_float32
is
not
None
:
# We compare the dtype AND the broadcast flag
# as this function do not broadcast
if
(
node
.
inputs
[
0
]
.
type
==
node
.
outputs
[
0
]
.
type
and
node
.
inputs
[
1
]
.
type
==
node
.
outputs
[
0
]
.
type
and
# amdlibm 3.0 do not have a float64 version of this SIMD function
node
.
inputs
[
0
]
.
dtype
==
'float32'
):
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
"""
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
()
# We compare the dtype and check we broadcast a scalar
elif
(
node
.
inputs
[
0
]
.
type
==
node
.
outputs
[
0
]
.
type
and
node
.
inputs
[
1
]
.
dtype
==
node
.
outputs
[
0
]
.
dtype
and
all
(
node
.
inputs
[
1
]
.
broadcastable
)
and
# amdlibm 3.0 do not have a float64 version of this SIMD function
node
.
inputs
[
0
]
.
dtype
==
'float32'
):
dtype
=
'float'
fct
=
"amd_vrsa_powxf"
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
()
raise
theano
.
gof
.
utils
.
MethodNotDefined
()
pow
=
Pow
(
upcast_out
,
name
=
'pow'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论