fixed decref order in Gemm code

上级 526f0626
...@@ -427,12 +427,12 @@ class Gemm(_Op): ...@@ -427,12 +427,12 @@ class Gemm(_Op):
return [['_z', '_a', '_x', '_y', '_b'], ['_zout']] return [['_z', '_a', '_x', '_y', '_b'], ['_zout']]
def c_validate_update(self, (_z, _a, _x, _y, _b), (_zout, ), sub): def c_validate_update(self, (_z, _a, _x, _y, _b), (_zout, ), sub):
return """ return """
if (%(_zout)s != %(_z)s)
{
if (%(_zout)s) if (%(_zout)s)
{ {
Py_DECREF(%(_zout)s); Py_DECREF(%(_zout)s);
} }
if (%(_zout)s != %(_z)s)
{
%(_zout)s = %(_z)s; %(_zout)s = %(_z)s;
Py_INCREF(%(_zout)s); Py_INCREF(%(_zout)s);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论