提交 15ea93f1 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

made various ops and variables include more information about their type in their __str__ method

上级 954b07ab
...@@ -145,7 +145,7 @@ class GpuElemwise(Op): ...@@ -145,7 +145,7 @@ class GpuElemwise(Op):
# We need to print the scalar_op, not only the its class name # We need to print the scalar_op, not only the its class name
# to have the full definition of composite op. # to have the full definition of composite op.
return "GpuElemwise{%s}%s" % (self.scalar_op, str(items)) return "GpuElemwise{%s}%s" % (self.scalar_op, str(items))
return "GpuElemwise{%s}" % (self.scalar_op) return "GpuElemwise{%s,no_inplace}" % (self.scalar_op)
def __repr__(self): def __repr__(self):
return self.__str__() return self.__str__()
......
...@@ -49,7 +49,7 @@ class CudaNdarrayConstant(Constant, _operators): ...@@ -49,7 +49,7 @@ class CudaNdarrayConstant(Constant, _operators):
def __str__(self): def __str__(self):
if self.name is not None: if self.name is not None:
return self.name return self.name
return "CudaNdarray{"+str(numpy.asarray(self.data))+"}" return "CudaNdarrayConstant{"+str(numpy.asarray(self.data))+"}"
CudaNdarrayType.Constant = CudaNdarrayConstant CudaNdarrayType.Constant = CudaNdarrayConstant
class CudaNdarraySharedVariable(SharedVariable, _operators): class CudaNdarraySharedVariable(SharedVariable, _operators):
......
...@@ -1298,6 +1298,9 @@ class TensorConstant(_tensor_py_operators, Constant): ...@@ -1298,6 +1298,9 @@ class TensorConstant(_tensor_py_operators, Constant):
To create a TensorConstant, use the `constant` function in this module. To create a TensorConstant, use the `constant` function in this module.
""" """
def __str__(self):
return "TensorConstant{%s}" % self.data
def signature(self): def signature(self):
return TensorConstantSignature((self.type, self.data)) return TensorConstantSignature((self.type, self.data))
TensorType.Constant = TensorConstant TensorType.Constant = TensorConstant
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论