提交 d20b4b45 authored 作者: Frederic Bastien's avatar Frederic Bastien

Use more frequently the pprint dict.

上级 59efbc13
...@@ -4113,8 +4113,7 @@ class Join(Op): ...@@ -4113,8 +4113,7 @@ class Join(Op):
join = Join() join = Join()
pprint.assign(lambda pstate, r: r.owner and isinstance(r.owner.op, Join), pprint.assign(Join, printing.FunctionPrinter('join'))
printing.FunctionPrinter('join'))
def roll(x, shift, axis=None): def roll(x, shift, axis=None):
......
...@@ -446,8 +446,7 @@ class DimShufflePrinter: ...@@ -446,8 +446,7 @@ class DimShufflePrinter:
else: else:
raise TypeError("Can only print DimShuffle.") raise TypeError("Can only print DimShuffle.")
pprint.assign(lambda pstate, r: r.owner and isinstance(r.owner.op, DimShuffle), pprint.assign(DimShuffle, DimShufflePrinter())
DimShufflePrinter())
################ ################
......
...@@ -26,12 +26,7 @@ def _scal_inplace(symbol): ...@@ -26,12 +26,7 @@ def _scal_inplace(symbol):
rval.__epydoc_asRoutine = symbol rval.__epydoc_asRoutine = symbol
rval.__module__ = 'theano.tensor.inplace' rval.__module__ = 'theano.tensor.inplace'
def chk(pstate, r): pprint.assign(rval, printing.FunctionPrinter(symbolname.replace('_inplace', '=')))
if not r.owner:
return False
return r.owner.op == rval
pprint.assign(chk, printing.FunctionPrinter(symbolname.replace('_inplace', '=')))
return rval return rval
......
...@@ -869,8 +869,7 @@ class MakeVectorPrinter: ...@@ -869,8 +869,7 @@ class MakeVectorPrinter:
else: else:
raise TypeError("Can only print make_vector.") raise TypeError("Can only print make_vector.")
T.pprint.assign(lambda pstate, r: r.owner and T.pprint.assign(MakeVector, MakeVectorPrinter())
isinstance(r.owner.op, MakeVector), MakeVectorPrinter())
class ShapeFeature(object): class ShapeFeature(object):
......
...@@ -1002,8 +1002,7 @@ class SubtensorPrinter: ...@@ -1002,8 +1002,7 @@ class SubtensorPrinter:
else: else:
raise TypeError("Can only print Subtensor.") raise TypeError("Can only print Subtensor.")
pprint.assign(lambda pstate, r: r.owner and isinstance(r.owner.op, Subtensor), pprint.assign(Subtensor, SubtensorPrinter())
SubtensorPrinter())
def set_subtensor(x, y, inplace=False, def set_subtensor(x, y, inplace=False,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论