Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b4312087
提交
b4312087
authored
3月 02, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
3月 03, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move basic type declarations from aesara.link.basic to aesara.graph.op
上级
2fbc3bb6
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
27 行增加
和
20 行删除
+27
-20
op.py
aesara/graph/op.py
+7
-4
basic.py
aesara/link/basic.py
+20
-16
没有找到文件。
aesara/graph/op.py
浏览文件 @
b4312087
...
...
@@ -36,13 +36,16 @@ if TYPE_CHECKING:
from
aesara.graph.fg
import
FunctionGraph
from
aesara.graph.type
import
Type
StorageMapType
=
Dict
[
Variable
,
List
[
Optional
[
List
[
Any
]]]]
StorageCellType
=
List
[
Optional
[
Any
]]
StorageMapType
=
Dict
[
Variable
,
StorageCellType
]
ComputeMapType
=
Dict
[
Variable
,
List
[
bool
]]
OutputStorageType
=
List
[
Optional
[
List
[
Any
]]]
InputStorageType
=
List
[
StorageCellType
]
OutputStorageType
=
List
[
StorageCellType
]
ParamsInputType
=
Optional
[
Tuple
[
Any
]]
PerformMethodType
=
Callable
[
[
Apply
,
List
[
Any
],
OutputStorageType
,
ParamsInputType
],
None
]
BasicThunkType
=
Callable
[[],
None
]
ThunkCallableType
=
Callable
[
[
PerformMethodType
,
StorageMapType
,
ComputeMapType
,
Apply
],
None
]
...
...
@@ -470,8 +473,8 @@ class Op(MetaObject):
def
prepare_node
(
self
,
node
:
Apply
,
storage_map
:
StorageMapType
,
compute_map
:
ComputeMapType
,
storage_map
:
Optional
[
StorageMapType
]
,
compute_map
:
Optional
[
ComputeMapType
]
,
impl
:
Optional
[
Text
],
)
->
None
:
"""Make any special modifications that the `Op` needs before doing :meth:`Op.make_thunk`.
...
...
aesara/link/basic.py
浏览文件 @
b4312087
...
...
@@ -24,12 +24,16 @@ from aesara.utils import difference
if
TYPE_CHECKING
:
from
aesara.compile.profiling
import
ProfileStats
from
aesara.graph.op
import
(
BasicThunkType
,
InputStorageType
,
OutputStorageType
,
StorageMapType
,
)
from
aesara.tensor.var
import
TensorVariable
StorageMapType
=
Dict
[
Variable
,
List
[
Optional
[
Union
[
ndarray
,
slice
]]]]
OutputStorageType
=
List
[
Optional
[
List
[
Any
]]]
InputStorageType
=
OutputStorageType
ThunkType
=
Tuple
[
Callable
[[],
None
],
List
[
"Container"
],
List
[
"Container"
]]
ThunkAndContainersType
=
Tuple
[
"BasicThunkType"
,
List
[
"Container"
],
List
[
"Container"
]]
class
Container
:
...
...
@@ -192,7 +196,7 @@ class Linker(ABC):
@abstractmethod
def
make_thunk
(
self
,
**
kwargs
)
->
Tuple
[
Callable
,
InputStorageType
,
OutputStorageType
]:
)
->
Tuple
[
Callable
,
"InputStorageType"
,
"OutputStorageType"
]:
"""
This function must return a triplet (function, input_variables,
output_variables) where function is a thunk that operates on the
...
...
@@ -242,11 +246,11 @@ class LocalLinker(Linker):
def
make_thunk
(
self
,
input_storage
:
Optional
[
InputStorageType
]
=
None
,
output_storage
:
Optional
[
OutputStorageType
]
=
None
,
storage_map
:
Optional
[
StorageMapType
]
=
None
,
input_storage
:
Optional
[
"InputStorageType"
]
=
None
,
output_storage
:
Optional
[
"OutputStorageType"
]
=
None
,
storage_map
:
Optional
[
"StorageMapType"
]
=
None
,
**
kwargs
,
)
->
Tuple
[
Callable
[[],
None
],
InputStorageType
,
OutputStorageType
]:
)
->
Tuple
[
"BasicThunkType"
,
"InputStorageType"
,
"OutputStorageType"
]:
return
self
.
make_all
(
input_storage
=
input_storage
,
output_storage
=
output_storage
,
...
...
@@ -255,14 +259,14 @@ class LocalLinker(Linker):
def
make_all
(
self
,
input_storage
:
Optional
[
InputStorageType
]
,
output_storage
:
Optional
[
OutputStorageType
]
,
storage_map
:
Optional
[
StorageMapType
]
,
input_storage
:
Optional
[
"InputStorageType"
]
=
None
,
output_storage
:
Optional
[
"OutputStorageType"
]
=
None
,
storage_map
:
Optional
[
"StorageMapType"
]
=
None
,
)
->
Tuple
[
Callable
[[],
None
]
,
InputStorageType
,
OutputStorageType
,
List
[
ThunkType
],
"BasicThunkType"
,
"InputStorageType"
,
"OutputStorageType"
,
List
[
Thunk
AndContainers
Type
],
List
[
Apply
],
]:
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论