self.shape_of={}# Variable -> tuple(scalars) or None (All tensor vars map to tuple)
# Must be local to the object as otherwise we reuse the same
self.scheduled={}# Variable ->
# variable for multiple env!
self.lscalar_one=T.constant(1,dtype='int64')
self.lscalar_one=T.constant(1,dtype='int64')
assertself.lscalar_one.type==T.lscalar
assertself.lscalar_one.type==T.lscalar
self.shape_of={}# Variable -> tuple(scalars) or None (All tensor vars map to tuple)
self.scheduled={}# Variable ->
fornodeinenv.toposort():
fornodeinenv.toposort():
self.on_import(env,node)
self.on_import(env,node)
...
@@ -725,12 +730,10 @@ class ShapeFeature(object):
...
@@ -725,12 +730,10 @@ class ShapeFeature(object):
'supported, and one should now use tensor.ShapeError '
'supported, and one should now use tensor.ShapeError '
'instead. The original exception message is: %s'%e)
'instead. The original exception message is: %s'%e)
exceptException,e:
exceptException,e:
_logger.error('Failed to infer_shape from Op %s (i_shapes=%s): %s%s'%(node.op,
_logger.error('Failed to infer_shape from Op %s.\nInput shapes:%s\nException encountered during infer_shape: %s\nException message: %s\nTraceback:%s'%(node.op,
[self.shape_of[r]forrinnode.inputs],
[self.shape_of[r]forrinnode.inputs],
type(e),str(e)))
type(e),str(e),traceback.format_exc()))
# We raise the exception to make sure the user knows something bad