提交 266c9209 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

modulo's C implementation will have to wait

上级 768eb415
...@@ -502,9 +502,7 @@ class Mod(BinaryScalarOp): ...@@ -502,9 +502,7 @@ class Mod(BinaryScalarOp):
def impl(self, x, y): def impl(self, x, y):
return x % y return x % y
def c_code(self, node, name, (x, y), (z, ), sub): def c_code(self, node, name, (x, y), (z, ), sub):
if node.inputs[0].type in int_types and node.inputs[1].type in int_types: raise NotImplementedError("Unlike Python, C's modulo returns negative modulo on negative dividend (to implement)")
raise NotImplementedError("For integer arguments the behavior of division in C and in Python differ when the quotient is negative (to implement).")
return "%(z)s = %(x)s %% %(y)s;" % locals()
def grad(self, (x, y), (gz, )): def grad(self, (x, y), (gz, )):
return None, None return None, None
mod = Mod(upcast_out, name = 'mod') mod = Mod(upcast_out, name = 'mod')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论