提交 dfc52a04 authored 作者: James Bergstra's avatar James Bergstra

Little hack in reshape() function to set the tag.shape of the output if the new…

Little hack in reshape() function to set the tag.shape of the output if the new shapeis a tuple or list.
上级 58667218
......@@ -2959,8 +2959,11 @@ def reshape(x, newshape, ndim=None, name=None):
if ndim is None:
ndim = get_vector_length(newshape)
op = Reshape(ndim, name)
return op(x, newshape)
rval = op(x, newshape)
if isinstance(newshape, (list, tuple)):
rval.tag.shape = newshape
return rval
class Flatten(Op):
"""Flattens a tensor to `outdim` dimensions by preserving the leading outdim-1 shape
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论