提交 a4a51b39 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

added error checking and doc to reshape

上级 202eed7f
...@@ -1492,7 +1492,20 @@ class _tensor_py_operators: ...@@ -1492,7 +1492,20 @@ class _tensor_py_operators:
:param ndim: the length of the shape. Passing None here means for :param ndim: the length of the shape. Passing None here means for
theano to try and guess the length of `shape`. theano to try and guess the length of `shape`.
* warning-- this has a different signature than numpy's
ndarray.reshape!
in numpy you do not need to wrap the shape arguments
in a tuple, in theano you do need to
""" """
if ndim is not None:
if not isinstance(ndim,int):
raise ValueError("Expected ndim to be an integer, is "\
+str(type(ndim)))
return reshape(self, shape, ndim=ndim) return reshape(self, shape, ndim=ndim)
def dimshuffle(self, *pattern): def dimshuffle(self, *pattern):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论