提交 4902b87f authored 作者: James Bergstra's avatar James Bergstra

added reshape member function for tensor variables

上级 999910f3
......@@ -584,6 +584,8 @@ class _tensor_py_operators:
T = property(lambda self: transpose(self))
shape = property(lambda self: shape(self))
def reshape(self, shape, ndim=None):
return reshape(self, shape, ndim=ndim)
#SLICING
# def __getitem__(self, args): return Subtensor.from_idxs(self,
......
......@@ -1854,6 +1854,10 @@ def test_smallest():
assert -4 == inplace_func([sx,sy], smallest(sx,sy))(-4.0, -2.0)
def test_reshape_member_fn():
x = dmatrix()
y = x.reshape((4,5,6))
assert y.owner.op == Reshape(3)
if __name__ == '__main__':
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论