raiseNotImplementedError('type not supported',type)
raiseNotImplementedError('type not supported',type)
if(node.inputs[0].typeindiscrete_typesand
if(node.inputs[0].typeindiscrete_typesand
node.inputs[1].typeindiscrete_types):
node.inputs[1].typeindiscrete_types):
return"%(z)s = ((double)%(x)s) / %(y)s;"%locals()
return"%(z)s = ((double)%(x)s) / %(y)s;"%locals()
return"%(z)s = %(x)s / %(y)s;"%locals()
return"%(z)s = %(x)s / %(y)s;"%locals()
defgrad(self,(x,y),(gz,)):
defgrad(self,(x,y),(gz,)):
ifx.typeincomplex_types:
ifx.typeincomplex_types:
raiseNotImplementedError()
raiseNotImplementedError()
...
@@ -1164,16 +1294,24 @@ class TrueDiv(BinaryScalarOp):
...
@@ -1164,16 +1294,24 @@ class TrueDiv(BinaryScalarOp):
asserty.typeindiscrete_types
asserty.typeindiscrete_types
second_part=None
second_part=None
returnfirst_part,second_part
returnfirst_part,second_part
true_div=TrueDiv(upcast_out,name='true_div')
true_div=TrueDiv(upcast_out,name='true_div')
classIntDiv(BinaryScalarOp):
classIntDiv(BinaryScalarOp):
defimpl(self,x,y):
defimpl(self,x,y):
returnx//y
returnx//y
defc_code(self,node,name,(x,y),(z,),sub):
raiseNotImplementedError("For integer arguments the behavior of division in C and in Python [can] differ when the quotient is negative. C actually does not even specify a correct behaviour in this case, it is up to the chip.")
defc_code(self,node,name,(x,y),(z,),sub):
raiseNotImplementedError("For integer arguments the behavior of"
" division in C and in Python [can] differ"
" when the quotient is negative. C actually"
" does not even specify a correct behaviour"
" in this case, it is up to the chip.")
defgrad(self,inputs,g_output):
defgrad(self,inputs,g_output):
return[None]*len(inputs)
return[None]*len(inputs)
int_div=IntDiv(upcast_out,name='int_div')
int_div=IntDiv(upcast_out,name='int_div')
floor_div=int_div
floor_div=int_div
...
@@ -1211,30 +1349,30 @@ class Mod(BinaryScalarOp):
...
@@ -1211,30 +1349,30 @@ class Mod(BinaryScalarOp):