提交 0143ddf1 authored 作者: abalkin's avatar abalkin 提交者: Frederic

Added a check that eigh and eig input is a matrix.

上级 5a46c7d8
...@@ -901,6 +901,7 @@ class Eig(Op): ...@@ -901,6 +901,7 @@ class Eig(Op):
def make_node(self, x): def make_node(self, x):
x = as_tensor_variable(x) x = as_tensor_variable(x)
assert x.ndim == 2
w = theano.tensor.vector(dtype=x.dtype) w = theano.tensor.vector(dtype=x.dtype)
v = theano.tensor.matrix(dtype=x.dtype) v = theano.tensor.matrix(dtype=x.dtype)
return Apply(self, [x], [w, v]) return Apply(self, [x], [w, v])
...@@ -944,6 +945,7 @@ class Eigh(Eig): ...@@ -944,6 +945,7 @@ class Eigh(Eig):
def make_node(self, x): def make_node(self, x):
x = as_tensor_variable(x) x = as_tensor_variable(x)
assert x.ndim == 2
# Numpy's linalg.eigh may return either double or single # Numpy's linalg.eigh may return either double or single
# presision eigenvalues depending on installed version of # presision eigenvalues depending on installed version of
# LAPACK. Rather than trying to reproduce the (rather # LAPACK. Rather than trying to reproduce the (rather
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论