提交 e52009c7 authored 作者: Frederic's avatar Frederic

detect more scalar type.

上级 12f0dac1
...@@ -785,7 +785,9 @@ class ShapeFeature(object): ...@@ -785,7 +785,9 @@ class ShapeFeature(object):
# don't make the optimizer merge a zillion ones together # don't make the optimizer merge a zillion ones together
# by always returning the same object to represent 1 # by always returning the same object to represent 1
return self.lscalar_one return self.lscalar_one
if type(s_i) in (int, long) or isinstance(s_i, numpy.integer): if (type(s_i) in (int, long) or
isinstance(s_i, numpy.integer) or
(isinstance(s_i, numpy.ndarray) and s_i.ndim == 0)):
# this shape is a constant # this shape is a constant
assert s_i >= 0 assert s_i >= 0
return T.constant(s_i, dtype='int64') return T.constant(s_i, dtype='int64')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论