提交 a3b4fd8c authored 作者: James Bergstra's avatar James Bergstra

merge

......@@ -116,7 +116,7 @@ class SoftmaxWithBias(gof.Op):
if ((%(x)s->dimensions[1] != %(b)s->dimensions[0]))
{
PyErr_Format(PyExc_ValueError, "number of columns in x (%%ld) does not match length of b (%%ld)",
%(x)s->dimensions[1], %(b)s->dimensions[0]);
(long int)%(x)s->dimensions[1], (long int)%(b)s->dimensions[0]);
%(fail)s;
}
......@@ -554,7 +554,7 @@ class CrossentropySoftmaxArgmax1HotWithBias(gof.Op):
if (%(x)s->dimensions[0] != %(y_idx)s->dimensions[0])
{
PyErr_Format(PyExc_ValueError, "number of rows in x (%%ld) does not match length of y (%%ld)",
%(x)s->dimensions[0], %(y_idx)s->dimensions[0]);
(long int)%(x)s->dimensions[0], (long int)%(y_idx)s->dimensions[0]);
%(fail)s;
}
......
......@@ -379,10 +379,13 @@ class ShapeFeature(object):
#
# worst case, we loop over shape_of and replace things
raise NotImplementedError(s_i)
elif s_i.type == T.lscalar:
elif s_i.type.dtype[:3] in ('int', 'uint'):
if getattr(s_i.type, 'ndim', 0):
raise TypeError('Shape element must be scalar', s_i)
return s_i
else:
raise TypeError('Unsupported shape element', s_i, s_i.type)
raise TypeError('Unsupported shape element',
s_i, type(s_i), getattr(s_i, 'type', None))
def set_shape(self, r, s):
assert r not in self.shape_of
......@@ -504,6 +507,7 @@ def local_shape_i_lift(node):
if inode and isinstance(inode.op, Elemwise) and inode.op.scalar_op.nin==1:
return node.env.shape_feature.shape_of[input]
register_canonicalize(local_shape_i_lift)
register_specialize(local_shape_i_lift)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论