提交 6b60c53a authored 作者: Hengjean's avatar Hengjean

Fixed errors

上级 a1f1dc66
......@@ -16,6 +16,8 @@ class _typed_list_py_operators:
def extend(self, toAppend):
return Extend()(self, toAppend)
ttype = property(lambda self: self.type.ttype)
class TypedListVariable(_typed_list_py_operators, Variable):
"""
......@@ -37,6 +39,7 @@ class GetItem(Op):
def make_node(self, x, index):
assert isinstance(x.type, TypedListType)
assert isinstance(index, Variable)
if isinstance(index.type, SliceType):
return Apply(self, [x, index], [x.type()])
elif isinstance(index, T.TensorVariable) and index.ndim == 0:
......@@ -75,6 +78,8 @@ class Append(Op):
def __str__(self):
return self.__class__.__name__
destroy_map = {0: [0]}
class Extend(Op):
"""
......@@ -97,3 +102,5 @@ class Extend(Op):
def __str__(self):
return self.__class__.__name__
destroy_map = {0: [0]}
......@@ -23,8 +23,6 @@ class TypedListType(gof.Type):
else:
self.ttype = TypedListType(ttype, depth - 1)
self.Variable.ttype = self.ttype
def filter(self, x, strict=False, allow_downcast=None):
"""
:Parameters:
......@@ -50,9 +48,6 @@ class TypedListType(gof.Type):
two list are equals if they contains the same type.
"""
if not hasattr(other, 'ttype'):
return False
return type(self) == type(other) and self.ttype == other.ttype
def __hash__(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论