提交 88516d2e authored 作者: Ricardo Vieira's avatar Ricardo Vieira 提交者: Ricardo Vieira

Simplify Scan string representation

上级 f6bb307d
...@@ -1282,27 +1282,18 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph): ...@@ -1282,27 +1282,18 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph):
) )
def __str__(self): def __str__(self):
device_str = "cpu" inplace = "none"
if self.info.as_while:
name = "do_while"
else:
name = "for"
aux_txt = "%s"
if len(self.destroy_map.keys()) > 0: if len(self.destroy_map.keys()) > 0:
# Check if all outputs are inplace # Check if all outputs are inplace
if sorted(self.destroy_map.keys()) == sorted( if sorted(self.destroy_map.keys()) == sorted(
range(self.info.n_mit_mot + self.info.n_mit_sot + self.info.n_sit_sot) range(self.info.n_mit_mot + self.info.n_mit_sot + self.info.n_sit_sot)
): ):
aux_txt += "all_inplace,%s,%s}" inplace = "all"
else: else:
aux_txt += "{inplace{" inplace = str(list(self.destroy_map.keys()))
for k in self.destroy_map.keys(): return (
aux_txt += str(k) + "," f"Scan{{{self.name}, while_loop={self.info.as_while}, inplace={inplace}}}"
aux_txt += "},%s,%s}" )
else:
aux_txt += "{%s,%s}"
aux_txt = aux_txt % (name, device_str, str(self.name))
return aux_txt
def __hash__(self): def __hash__(self):
return hash( return hash(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论