提交 452b6e2b authored 作者: Frederic's avatar Frederic

Fix crash and comment.

上级 2f252daa
...@@ -217,7 +217,8 @@ class Shape(gof.Op): ...@@ -217,7 +217,8 @@ class Shape(gof.Op):
def make_node(self, x): def make_node(self, x):
# Must work for all type that have a shape attribute. # Must work for all type that have a shape attribute.
# This will fail at execution time. # This will fail at execution time.
if not isinstance(x, theano.Variable):
x = theano.tensor.as_tensor_variable(x)
return gof.Apply(self, [x], [theano.tensor.lvector()]) return gof.Apply(self, [x], [theano.tensor.lvector()])
def perform(self, node, inp, out_): def perform(self, node, inp, out_):
......
...@@ -298,7 +298,7 @@ theano.compile.register_view_op_c_code(GpuArrayType, """ ...@@ -298,7 +298,7 @@ theano.compile.register_view_op_c_code(GpuArrayType, """
Py_XINCREF(%(oname)s); Py_XINCREF(%(oname)s);
""", version=(0,)) """, version=(0,))
# Register TensorType C code for Shape Op. # Register GpuArrayType C code for Shape Op.
theano.compile.register_shape_c_code( theano.compile.register_shape_c_code(
GpuArrayType, GpuArrayType,
""" """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论