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

Use more frequently the pprint dict.

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