提交 75049c1c authored 作者: Frederic's avatar Frederic

Make some reduction print there acc_dtype.

上级 4b11b2ba
...@@ -1836,6 +1836,20 @@ class CAReduceDtype(CAReduce): ...@@ -1836,6 +1836,20 @@ class CAReduceDtype(CAReduce):
assert op.acc_dtype is not None assert op.acc_dtype is not None
return CAReduce.make_node(op, input) return CAReduce.make_node(op, input)
def __str__(self):
name = self.__class__.__name__
if self.__class__.__name__ == "CAReduceDtype":
name = "ReduceDtype{%s}" % self.scalar_op,
axis = ""
if self.axis is not None:
axis = ", ".join(str(x) for x in self.axis)
axis = "axis=[%s], " % axis
return "%s{%sacc_dtype=%s}" % (
name,
axis,
str(self.acc_dtype)
)
class Sum(CAReduceDtype): class Sum(CAReduceDtype):
""" """
...@@ -1908,12 +1922,6 @@ class Sum(CAReduceDtype): ...@@ -1908,12 +1922,6 @@ class Sum(CAReduceDtype):
return [None] return [None]
return self(*eval_points, **dict(return_list=True)) return self(*eval_points, **dict(return_list=True))
def __str__(self):
if self.axis is None:
return "Sum"
else:
return "Sum{%s}" % ", ".join(map(str, self.axis))
class Prod(CAReduceDtype): class Prod(CAReduceDtype):
""" """
...@@ -2067,12 +2075,6 @@ class Prod(CAReduceDtype): ...@@ -2067,12 +2075,6 @@ class Prod(CAReduceDtype):
return [final_grad] return [final_grad]
def __str__(self):
if self.axis is None:
return "Prod"
else:
return "Prod{%s}" % ", ".join(map(str, self.axis))
def c_code_cache_version(self): def c_code_cache_version(self):
return (1,) return (1,)
...@@ -2113,9 +2115,3 @@ class ProdWithoutZeros(CAReduceDtype): ...@@ -2113,9 +2115,3 @@ class ProdWithoutZeros(CAReduceDtype):
def __init__(self, axis=None, dtype=None, acc_dtype=None): def __init__(self, axis=None, dtype=None, acc_dtype=None):
CAReduceDtype.__init__(self, mul_without_zeros, axis=axis, CAReduceDtype.__init__(self, mul_without_zeros, axis=axis,
dtype=dtype, acc_dtype=acc_dtype) dtype=dtype, acc_dtype=acc_dtype)
def __str__(self):
if self.axis is None:
return "ProdWithoutZeros"
else:
return "ProdWithoutZeros{%s}" % ", ".join(map(str, self.axis))
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论