提交 fc0a4071 authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Fix typing issues in aesara.graph.opt_utils

上级 51464cd1
import copy
from typing import Generator, Sequence, Union
from typing import Generator, Sequence, Union, cast
import aesara
from aesara.graph.basic import (
......@@ -210,11 +210,14 @@ def get_clients_at_depth(
fgraph: FunctionGraph, node: Apply, depth: int
) -> Generator[Apply, None, None]:
"""Yields node clients at given depth."""
for node in node.outputs:
for var in node.outputs:
if depth > 0:
for out_node, _ in fgraph.clients[node]:
for out_node, _ in fgraph.clients[var]:
if out_node == "output":
continue
yield from get_clients_at_depth(fgraph, out_node, depth - 1)
yield from get_clients_at_depth(
fgraph, cast(Apply, out_node), depth - 1
)
else:
yield node.owner
assert var.owner is not None
yield var.owner
......@@ -115,10 +115,6 @@ check_untyped_defs = False
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.graph.opt_utils]
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.graph.unify]
ignore_errors = True
check_untyped_defs = False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论