Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1f8764ca
提交
1f8764ca
authored
12月 29, 2021
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
1月 13, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix Elemwise docstrings
上级
389cdde6
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
26 行增加
和
25 行删除
+26
-25
elemwise.py
aesara/tensor/elemwise.py
+26
-25
没有找到文件。
aesara/tensor/elemwise.py
浏览文件 @
1f8764ca
...
@@ -303,40 +303,21 @@ pprint.assign(DimShuffle, DimShufflePrinter())
...
@@ -303,40 +303,21 @@ pprint.assign(DimShuffle, DimShufflePrinter())
class
Elemwise
(
OpenMPOp
):
class
Elemwise
(
OpenMPOp
):
"""
"""Generalizes a scalar `Op` to tensors.
Generalizes a scalar op to tensors.
All the inputs must have the same number of dimensions. When the
All the inputs must have the same number of dimensions. When the
Op
is performed, for each dimension, each input's size for that
`Op`
is performed, for each dimension, each input's size for that
dimension must be the same. As a special case, it can also be
1
dimension must be the same. As a special case, it can also be
one
but only if the input's
broadcastable flag is True
for that
but only if the input's
`broadcastable` flag is ``True``
for that
dimension. In that case, the tensor is (virtually) replicated
dimension. In that case, the tensor is (virtually) replicated
along that dimension to match the size of the others.
along that dimension to match the size of the others.
The dtypes of the outputs mirror those of the scalar
Op
that is
The dtypes of the outputs mirror those of the scalar
`Op`
that is
being generalized to tensors. In particular, if the calculations
being generalized to tensors. In particular, if the calculations
for an output are done inplace on an input, the output type must
for an output are done in
-
place on an input, the output type must
be the same as the corresponding input type (see the doc of
be the same as the corresponding input type (see the doc of
`ScalarOp` to get help about controlling the output type)
`ScalarOp` to get help about controlling the output type)
Parameters
----------
scalar_op
An instance of a subclass of `ScalarOp` which works uniquely
on scalars.
inplace_pattern
A dictionary that maps the index of an output to the
index of an input so the output is calculated inplace using
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 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.
Notes
Notes
-----
-----
| Elemwise(add) represents + on tensors (x + y)
| Elemwise(add) represents + on tensors (x + y)
...
@@ -356,6 +337,26 @@ second dimension
...
@@ -356,6 +337,26 @@ second dimension
def
__init__
(
def
__init__
(
self
,
scalar_op
,
inplace_pattern
=
None
,
name
=
None
,
nfunc_spec
=
None
,
openmp
=
None
self
,
scalar_op
,
inplace_pattern
=
None
,
name
=
None
,
nfunc_spec
=
None
,
openmp
=
None
):
):
"""
Parameters
----------
scalar_op
An instance of a subclass of `ScalarOp` which works uniquely
on scalars.
inplace_pattern
A dictionary that maps the index of an output to the
index of an input so the output is calculated inplace using
the input's storage. (Just like `Op.destroy_map`, 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``-many inputs and ``nout``-many outputs. Note
that ``nin`` cannot always be inferred from the scalar `Op`'s own
``nin`` field, because that value is sometimes zero (meaning a variable
number of inputs), whereas the NumPy function may not have var-args.
"""
assert
not
isinstance
(
scalar_op
,
type
(
self
))
assert
not
isinstance
(
scalar_op
,
type
(
self
))
if
inplace_pattern
is
None
:
if
inplace_pattern
is
None
:
inplace_pattern
=
frozendict
({})
inplace_pattern
=
frozendict
({})
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论