Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
712660e7
提交
712660e7
authored
6月 21, 2023
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
6月 26, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make reshape ndim kwarg only
This prevents surprises when passing two scalars, which are interpreted differently in the numpy API
上级
f27ac453
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
8 行增加
和
5 行删除
+8
-5
extra_ops.py
pytensor/tensor/extra_ops.py
+4
-1
math.py
pytensor/tensor/math.py
+1
-1
subtensor.py
pytensor/tensor/rewriting/subtensor.py
+1
-1
slinalg.py
pytensor/tensor/slinalg.py
+1
-1
var.py
pytensor/tensor/var.py
+1
-1
没有找到文件。
pytensor/tensor/extra_ops.py
浏览文件 @
712660e7
...
...
@@ -708,7 +708,10 @@ class Repeat(Op):
shape
=
[
x
.
shape
[
k
]
for
k
in
range
(
x
.
ndim
)]
shape
.
insert
(
axis
,
repeats
)
return
[
gz
.
reshape
(
shape
,
x
.
ndim
+
1
)
.
sum
(
axis
=
axis
),
DisconnectedType
()()]
return
[
gz
.
reshape
(
shape
,
ndim
=
x
.
ndim
+
1
)
.
sum
(
axis
=
axis
),
DisconnectedType
()(),
]
elif
repeats
.
ndim
==
1
:
# For this implementation, we would need to specify the length
# of repeats in order to split gz in the right way to sum
...
...
pytensor/tensor/math.py
浏览文件 @
712660e7
...
...
@@ -2196,7 +2196,7 @@ def _tensordot_as_dot(a, b, axes, dot, batched):
b_reshaped
=
b
.
reshape
(
b_shape
)
out_reshaped
=
dot
(
a_reshaped
,
b_reshaped
)
out
=
out_reshaped
.
reshape
(
outshape
,
outndim
)
out
=
out_reshaped
.
reshape
(
outshape
,
ndim
=
outndim
)
# Make sure the broadcastable pattern of the result is correct,
# since some shape information can be lost in the reshapes.
if
out
.
type
.
broadcastable
!=
outbcast
:
...
...
pytensor/tensor/rewriting/subtensor.py
浏览文件 @
712660e7
...
...
@@ -155,7 +155,7 @@ def transform_take(a, indices, axis):
ndim
=
a
.
ndim
+
indices
.
ndim
-
1
return
transform_take
(
a
,
indices
.
flatten
(),
axis
)
.
reshape
(
shape
,
ndim
)
return
transform_take
(
a
,
indices
.
flatten
(),
axis
)
.
reshape
(
shape
,
ndim
=
ndim
)
def
is_full_slice
(
x
):
...
...
pytensor/tensor/slinalg.py
浏览文件 @
712660e7
...
...
@@ -580,7 +580,7 @@ def kron(a, b):
f
"You passed {int(a.ndim)} and {int(b.ndim)}."
)
o
=
atm
.
outer
(
a
,
b
)
o
=
o
.
reshape
(
at
.
concatenate
((
a
.
shape
,
b
.
shape
)),
a
.
ndim
+
b
.
ndim
)
o
=
o
.
reshape
(
at
.
concatenate
((
a
.
shape
,
b
.
shape
)),
ndim
=
a
.
ndim
+
b
.
ndim
)
shf
=
o
.
dimshuffle
(
0
,
2
,
1
,
*
list
(
range
(
3
,
o
.
ndim
)))
if
shf
.
ndim
==
3
:
shf
=
o
.
dimshuffle
(
1
,
0
,
2
)
...
...
pytensor/tensor/var.py
浏览文件 @
712660e7
...
...
@@ -283,7 +283,7 @@ class _tensor_py_operators:
# "Variable) due to Python restriction. You can use "
# "PyTensorVariable.shape[0] instead.")
def
reshape
(
self
,
shape
,
ndim
=
None
):
def
reshape
(
self
,
shape
,
*
,
ndim
=
None
):
"""Return a reshaped view/copy of this variable.
Parameters
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论