Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8112576b
提交
8112576b
authored
6月 20, 2023
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
6月 21, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Stop using deprecated `numpy.product`
上级
22e9233e
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
7 行增加
和
7 行删除
+7
-7
basic.py
pytensor/scalar/basic.py
+1
-1
test_extra_ops.py
tests/link/jax/test_extra_ops.py
+2
-2
test_extra_ops.py
tests/tensor/test_extra_ops.py
+2
-2
test_subtensor.py
tests/tensor/test_subtensor.py
+2
-2
没有找到文件。
pytensor/scalar/basic.py
浏览文件 @
8112576b
...
...
@@ -1895,7 +1895,7 @@ class Mul(ScalarOp):
nfunc_variadic
=
"product"
def
impl
(
self
,
*
inputs
):
return
np
.
prod
uct
(
inputs
)
return
np
.
prod
(
inputs
)
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
(
z
,)
=
outputs
...
...
tests/link/jax/test_extra_ops.py
浏览文件 @
8112576b
...
...
@@ -55,7 +55,7 @@ def test_extra_ops():
fgraph
=
FunctionGraph
([
a
],
[
out
])
compare_jax_and_py
(
fgraph
,
[
get_test_value
(
i
)
for
i
in
fgraph
.
inputs
])
indices
=
np
.
arange
(
np
.
prod
uct
((
3
,
4
)))
indices
=
np
.
arange
(
np
.
prod
((
3
,
4
)))
out
=
at_extra_ops
.
unravel_index
(
indices
,
(
3
,
4
),
order
=
"C"
)
fgraph
=
FunctionGraph
([],
out
)
compare_jax_and_py
(
...
...
@@ -100,7 +100,7 @@ def test_extra_ops_omni():
fgraph
=
FunctionGraph
([],
[
out
])
compare_jax_and_py
(
fgraph
,
[
get_test_value
(
i
)
for
i
in
fgraph
.
inputs
])
multi_index
=
np
.
unravel_index
(
np
.
arange
(
np
.
prod
uct
((
3
,
4
))),
(
3
,
4
))
multi_index
=
np
.
unravel_index
(
np
.
arange
(
np
.
prod
((
3
,
4
))),
(
3
,
4
))
out
=
at_extra_ops
.
ravel_multi_index
(
multi_index
,
(
3
,
4
))
fgraph
=
FunctionGraph
([],
[
out
])
compare_jax_and_py
(
...
...
tests/tensor/test_extra_ops.py
浏览文件 @
8112576b
...
...
@@ -925,7 +925,7 @@ class TestUnique(utt.InferShapeTester):
class
TestUnravelIndex
(
utt
.
InferShapeTester
):
def
test_unravel_index
(
self
):
def
check
(
shape
,
index_ndim
,
order
):
indices
=
np
.
arange
(
np
.
prod
uct
(
shape
))
indices
=
np
.
arange
(
np
.
prod
(
shape
))
# test with scalars and higher-dimensional indices
if
index_ndim
==
0
:
indices
=
indices
[
-
1
]
...
...
@@ -996,7 +996,7 @@ class TestRavelMultiIndex(utt.InferShapeTester):
def
test_ravel_multi_index
(
self
):
def
check
(
shape
,
index_ndim
,
mode
,
order
):
multi_index
=
np
.
unravel_index
(
np
.
arange
(
np
.
prod
uct
(
shape
)),
shape
,
order
=
order
np
.
arange
(
np
.
prod
(
shape
)),
shape
,
order
=
order
)
# create some invalid indices to test the mode
if
mode
in
(
"wrap"
,
"clip"
):
...
...
tests/tensor/test_subtensor.py
浏览文件 @
8112576b
...
...
@@ -1151,7 +1151,7 @@ class TestSubtensor(utt.OptimizationTestMixin):
for
inplace
in
(
False
,
True
):
for
data_shape
in
((
10
,),
(
4
,
5
),
(
1
,
2
,
3
),
(
4
,
5
,
6
,
7
)):
data_n_dims
=
len
(
data_shape
)
data_size
=
np
.
prod
uct
(
data_shape
)
data_size
=
np
.
prod
(
data_shape
)
# Corresponding numeric variable.
data_num_init
=
np
.
arange
(
data_size
,
dtype
=
self
.
dtype
)
data_num_init
=
data_num_init
.
reshape
(
data_shape
)
...
...
@@ -1203,7 +1203,7 @@ class TestSubtensor(utt.OptimizationTestMixin):
# The param dtype is needed when inc_shape is empty.
# By default, it would return a float and rng.uniform
# with NumPy 1.10 will raise a Deprecation warning.
inc_size
=
np
.
prod
uct
(
inc_shape
,
dtype
=
"int"
)
inc_size
=
np
.
prod
(
inc_shape
,
dtype
=
"int"
)
# Corresponding numeric variable.
inc_num
=
rng
.
uniform
(
size
=
inc_size
)
.
astype
(
self
.
dtype
)
inc_num
=
inc_num
.
reshape
(
inc_shape
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论