Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
81369296
提交
81369296
authored
11月 06, 2014
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove stale code for reusing output buffer in elemwise perform
上级
4b374abe
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
47 行删除
+11
-47
basic.py
theano/tensor/basic.py
+5
-5
elemwise.py
theano/tensor/elemwise.py
+6
-42
没有找到文件。
theano/tensor/basic.py
浏览文件 @
81369296
...
...
@@ -1812,7 +1812,7 @@ def round(a, mode="half_away_from_zero"):
raise
Exception
(
"round mode
%
s is not implemented."
%
mode
)
@_scal_elemwise_with_nfunc
(
'around'
,
1
,
-
1
)
@_scal_elemwise_with_nfunc
(
'around'
,
1
,
1
)
def
round_half_to_even
(
a
):
"""round_half_to_even(a)"""
...
...
@@ -1952,20 +1952,20 @@ def chi2sf(x, k):
#numpy.real(float32) return a view on the inputs.
#@_scal_elemwise_with_nfunc('real', 1,
-
1)
#@_scal_elemwise_with_nfunc('real', 1, 1)
@_scal_elemwise
def
real
(
z
):
"""Return real component of complex-valued tensor `z`"""
_tensor_py_operators
.
real
=
property
(
real
)
@_scal_elemwise_with_nfunc
(
'imag'
,
1
,
-
1
)
@_scal_elemwise_with_nfunc
(
'imag'
,
1
,
1
)
def
imag
(
z
):
"""Return imaginary component of complex-valued tensor `z`"""
_tensor_py_operators
.
imag
=
property
(
imag
)
@_scal_elemwise_with_nfunc
(
'angle'
,
1
,
-
1
)
@_scal_elemwise_with_nfunc
(
'angle'
,
1
,
1
)
def
angle
(
z
):
"""Return polar-coordinate angle of complex-valued tensor `z`"""
...
...
@@ -1975,7 +1975,7 @@ def complex(real, imag):
"""Return complex-valued tensor with `real` and `imag` components"""
@_scal_elemwise_with_nfunc
(
'conj'
,
1
,
-
1
)
@_scal_elemwise_with_nfunc
(
'conj'
,
1
,
1
)
def
conj
(
z
):
"""Return the complex conjugate of `z`."""
...
...
theano/tensor/elemwise.py
浏览文件 @
81369296
...
...
@@ -473,14 +473,11 @@ class Elemwise(OpenMPOp):
the input's storage. (Just like destroymap, but without the lists.)
* nfunc_spec: either None or a tuple of three elements,
(nfunc_name, nin, nout) such that getattr(numpy, nfunc_name)
implements this operation, takes nin inputs and abs(nout) outputs
(nout < 0 if the numpy function does not provide the option of
providing a numpy array to store the results in). Note that nin
cannot always be inferred from the scalar op's own nin field
because that value is sometimes 0 (meaning a variable number of
inputs), whereas the numpy function may not have varargs.
NOTE: as of now, the sign of the nout field is ignored (some work
needs to be done to resize the destinations when needed).
implements this operation, takes nin inputs and nout outputs.
Note that nin cannot always be inferred from the scalar op's
own nin field because that value is sometimes 0 (meaning a
variable number of inputs), whereas the numpy function may
not have varargs.
"""
if
inplace_pattern
is
None
:
inplace_pattern
=
{}
...
...
@@ -820,44 +817,11 @@ class Elemwise(OpenMPOp):
out_shape
.
append
(
max
(
values
))
out_shape
=
tuple
(
out_shape
)
# Commented as we don't reuse outputs now.
#
# if not self.inplace_pattern:
# for output, storage in izip(node.outputs, output_storage):
# odat = storage[0]
# if odat is not None:
# if odat.shape != out_shape:
# # It is unsafe to try to resize odat,
# # we have to allocate output storage.
# odat = None
# if odat is None:
# odat = numpy.ndarray(out_shape, dtype=output.type.dtype)
# storage[0] = odat
# else:
# for i, (output, storage) in enumerate(
# izip(node.outputs, output_storage)):
# #i is an output idx
# if i in self.inplace_pattern:
# odat = inputs[self.inplace_pattern[i]]
# else:
# odat = storage[0]
# if odat is not None:
# if odat.shape != out_shape:
# # It is unsafe to try to resize odat,
# # we have to allocate output storage.
# odat = None
# if odat is None:
# odat = numpy.ndarray(out_shape,
# dtype=output.type.dtype)
# storage[0] = odat
ufunc_args
=
inputs
# + output_storage
ufunc_args
=
inputs
ufunc_kwargs
=
{}
if
self
.
nfunc
and
len
(
inputs
)
==
self
.
nfunc_spec
[
1
]:
ufunc
=
self
.
nfunc
nout
=
self
.
nfunc_spec
[
2
]
if
nout
<
0
:
nout
=
-
nout
# Numpy ufuncs will sometimes perform operations in
# float16, in particular when the input is int8.
# This is not something that we want, and we do not
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论