提交 74af3ca2 authored 作者: Brandon T. Willard's avatar Brandon T. Willard

Rename scratchpad class to Scratchpad

上级 2352fcec
...@@ -92,7 +92,7 @@ class Apply(Node): ...@@ -92,7 +92,7 @@ class Apply(Node):
def __init__(self, op, inputs, outputs): def __init__(self, op, inputs, outputs):
self.op = op self.op = op
self.inputs = [] self.inputs = []
self.tag = utils.scratchpad() self.tag = utils.Scratchpad()
if not isinstance(inputs, (list, tuple)): if not isinstance(inputs, (list, tuple)):
raise TypeError("The inputs of an Apply must be a list or tuple") raise TypeError("The inputs of an Apply must be a list or tuple")
...@@ -383,7 +383,8 @@ class Variable(Node): ...@@ -383,7 +383,8 @@ class Variable(Node):
def __init__(self, type, owner=None, index=None, name=None): def __init__(self, type, owner=None, index=None, name=None):
super(Variable, self).__init__() super(Variable, self).__init__()
self.tag = utils.scratchpad() self.tag = utils.Scratchpad()
self.type = type self.type = type
if owner is not None and not isinstance(owner, Apply): if owner is not None and not isinstance(owner, Apply):
raise TypeError("owner must be an Apply instance", owner) raise TypeError("owner must be an Apply instance", owner)
......
...@@ -239,7 +239,7 @@ class object2(with_metaclass(MetaObject, object)): ...@@ -239,7 +239,7 @@ class object2(with_metaclass(MetaObject, object)):
return not self == other return not self == other
class scratchpad(object): class Scratchpad(object):
def clear(self): def clear(self):
self.__dict__.clear() self.__dict__.clear()
......
...@@ -68,7 +68,7 @@ class StripPickler(Pickler): ...@@ -68,7 +68,7 @@ class StripPickler(Pickler):
def save(self, obj): def save(self, obj):
# Remove the tag.trace attribute from Variable and Apply nodes # Remove the tag.trace attribute from Variable and Apply nodes
if isinstance(obj, theano.gof.utils.scratchpad): if isinstance(obj, theano.gof.utils.Scratchpad):
for tag in self.tag_to_remove: for tag in self.tag_to_remove:
if hasattr(obj, tag): if hasattr(obj, tag):
del obj.__dict__[tag] del obj.__dict__[tag]
......
...@@ -371,11 +371,11 @@ class Print(Op): ...@@ -371,11 +371,11 @@ class Print(Op):
return (1,) return (1,)
class PrinterState(gof.utils.scratchpad): class PrinterState(gof.utils.Scratchpad):
def __init__(self, props=None, **more_props): def __init__(self, props=None, **more_props):
if props is None: if props is None:
props = {} props = {}
elif isinstance(props, gof.utils.scratchpad): elif isinstance(props, gof.utils.Scratchpad):
self.__update__(props) self.__update__(props)
else: else:
self.__dict__.update(props) self.__dict__.update(props)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论