提交 138953bd authored 作者: Frederic Bastien's avatar Frederic Bastien

better error msg.

上级 058ccac5
...@@ -166,9 +166,10 @@ class SparseType(gof.Type): ...@@ -166,9 +166,10 @@ class SparseType(gof.Type):
return value return value
if strict: if strict:
raise TypeError("%s is not sparse" % value) raise TypeError("%s is not sparse" % value)
#The input format could be converted here
sp = self.format_cls[self.format](value) sp = self.format_cls[self.format](value)
if str(sp.dtype) != self.dtype: if str(sp.dtype) != self.dtype:
raise NotImplementedError() raise NotImplementedError("Expected %s dtype but got %s"%(self.dtype,str(sp.dtype)))
if sp.format != self.format: if sp.format != self.format:
raise NotImplementedError() raise NotImplementedError()
return sp return sp
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论