提交 bd7d8d2e authored 作者: Frederic Bastien's avatar Frederic Bastien

make var.shape use the new shape feature to always return a shape object.

上级 2fc8a039
...@@ -1287,9 +1287,8 @@ class Shape(Op): ...@@ -1287,9 +1287,8 @@ class Shape(Op):
out[0] = theano._asarray(x.shape, dtype = 'int64') out[0] = theano._asarray(x.shape, dtype = 'int64')
def grad(self, (x,), (gz,)): def grad(self, (x,), (gz,)):
return [None] return [None]
_shape = Shape()
@constructor @constructor
def shape(a): def old_shape(a):
"""Return the shape tuple of a TensorType Variable, it may be either symbolic or nonsymbolic. """Return the shape tuple of a TensorType Variable, it may be either symbolic or nonsymbolic.
If the shape of the expression is not known at graph-construction time, then a symbolic If the shape of the expression is not known at graph-construction time, then a symbolic
...@@ -1305,6 +1304,8 @@ def shape(a): ...@@ -1305,6 +1304,8 @@ def shape(a):
# a tuple directly. This tuple is like the numpy.ndarray.shape tuple. # a tuple directly. This tuple is like the numpy.ndarray.shape tuple.
return va.type.shape return va.type.shape
shape = Shape()
_shape = shape #was used in the past, now use shape directly.
pprint.assign(_shape, printing.MemberPrinter('shape')) pprint.assign(_shape, printing.MemberPrinter('shape'))
class MaxAndArgmax(Op): class MaxAndArgmax(Op):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论