Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7ccde642
提交
7ccde642
authored
11月 27, 2025
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
11月 27, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change TypedList Count and Index output to int64
上级
f49a6c51
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
6 行增加
和
7 行删除
+6
-7
basic.py
pytensor/typed_list/basic.py
+6
-7
没有找到文件。
pytensor/typed_list/basic.py
浏览文件 @
7ccde642
...
@@ -2,11 +2,10 @@ import numpy as np
...
@@ -2,11 +2,10 @@ import numpy as np
import
pytensor.tensor
as
pt
import
pytensor.tensor
as
pt
from
pytensor.compile.debugmode
import
_lessbroken_deepcopy
from
pytensor.compile.debugmode
import
_lessbroken_deepcopy
from
pytensor.configdefaults
import
config
from
pytensor.graph.basic
import
Apply
,
Constant
,
Variable
from
pytensor.graph.basic
import
Apply
,
Constant
,
Variable
from
pytensor.graph.op
import
Op
from
pytensor.graph.op
import
Op
from
pytensor.link.c.op
import
COp
from
pytensor.link.c.op
import
COp
from
pytensor.tensor.type
import
scalar
from
pytensor.tensor.type
import
l
scalar
from
pytensor.tensor.type_other
import
SliceType
from
pytensor.tensor.type_other
import
SliceType
from
pytensor.tensor.variable
import
TensorVariable
from
pytensor.tensor.variable
import
TensorVariable
from
pytensor.typed_list.type
import
TypedListType
from
pytensor.typed_list.type
import
TypedListType
...
@@ -508,7 +507,7 @@ class Index(Op):
...
@@ -508,7 +507,7 @@ class Index(Op):
def
make_node
(
self
,
x
,
elem
):
def
make_node
(
self
,
x
,
elem
):
assert
isinstance
(
x
.
type
,
TypedListType
)
assert
isinstance
(
x
.
type
,
TypedListType
)
assert
x
.
ttype
==
elem
.
type
assert
x
.
ttype
==
elem
.
type
return
Apply
(
self
,
[
x
,
elem
],
[
scalar
()])
return
Apply
(
self
,
[
x
,
elem
],
[
l
scalar
()])
def
perform
(
self
,
node
,
inputs
,
outputs
):
def
perform
(
self
,
node
,
inputs
,
outputs
):
"""
"""
...
@@ -520,7 +519,7 @@ class Index(Op):
...
@@ -520,7 +519,7 @@ class Index(Op):
(
out
,)
=
outputs
(
out
,)
=
outputs
for
y
in
range
(
len
(
x
)):
for
y
in
range
(
len
(
x
)):
if
node
.
inputs
[
0
]
.
ttype
.
values_eq
(
x
[
y
],
elem
):
if
node
.
inputs
[
0
]
.
ttype
.
values_eq
(
x
[
y
],
elem
):
out
[
0
]
=
np
.
asarray
(
y
,
dtype
=
config
.
floatX
)
out
[
0
]
=
np
.
asarray
(
y
,
dtype
=
"int64"
)
break
break
def
__str__
(
self
):
def
__str__
(
self
):
...
@@ -537,7 +536,7 @@ class Count(Op):
...
@@ -537,7 +536,7 @@ class Count(Op):
def
make_node
(
self
,
x
,
elem
):
def
make_node
(
self
,
x
,
elem
):
assert
isinstance
(
x
.
type
,
TypedListType
)
assert
isinstance
(
x
.
type
,
TypedListType
)
assert
x
.
ttype
==
elem
.
type
assert
x
.
ttype
==
elem
.
type
return
Apply
(
self
,
[
x
,
elem
],
[
scalar
()])
return
Apply
(
self
,
[
x
,
elem
],
[
l
scalar
()])
def
perform
(
self
,
node
,
inputs
,
outputs
):
def
perform
(
self
,
node
,
inputs
,
outputs
):
"""
"""
...
@@ -551,7 +550,7 @@ class Count(Op):
...
@@ -551,7 +550,7 @@ class Count(Op):
for
y
in
range
(
len
(
x
)):
for
y
in
range
(
len
(
x
)):
if
node
.
inputs
[
0
]
.
ttype
.
values_eq
(
x
[
y
],
elem
):
if
node
.
inputs
[
0
]
.
ttype
.
values_eq
(
x
[
y
],
elem
):
out
[
0
]
+=
1
out
[
0
]
+=
1
out
[
0
]
=
np
.
asarray
(
out
[
0
],
dtype
=
config
.
floatX
)
out
[
0
]
=
np
.
asarray
(
out
[
0
],
"int64"
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
__class__
.
__name__
return
self
.
__class__
.
__name__
...
@@ -583,7 +582,7 @@ class Length(COp):
...
@@ -583,7 +582,7 @@ class Length(COp):
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
assert
isinstance
(
x
.
type
,
TypedListType
)
assert
isinstance
(
x
.
type
,
TypedListType
)
return
Apply
(
self
,
[
x
],
[
scalar
(
dtype
=
"int64"
)])
return
Apply
(
self
,
[
x
],
[
lscalar
(
)])
def
perform
(
self
,
node
,
x
,
outputs
):
def
perform
(
self
,
node
,
x
,
outputs
):
(
out
,)
=
outputs
(
out
,)
=
outputs
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论