File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -271,17 +271,17 @@ def rtruediv_op(a, b):
271
271
272
272
@ophelper
273
273
def pow_op (a , b ):
274
- if (b .astKind in ('int' , 'long' ) and
275
- a .astKind in ('int' , 'long' ) and
276
- numpy .any (b .value < 0 )):
277
-
278
- raise ValueError (
279
- 'Integers to negative integer powers are not allowed.' )
280
-
281
274
if allConstantNodes ([a , b ]):
282
275
return ConstantNode (a .value ** b .value )
283
276
if isinstance (b , ConstantNode ):
284
277
x = b .value
278
+ # Numpy Error: Integers to negative integer powers are not allowed.
279
+ # if a is a vector of numpy integer, b is not allowed to be a negative integer(number or vector).
280
+ if (a .astKind in ('int' , 'long' ) and
281
+ b .astKind in ('int' , 'long' ) and
282
+ x < 0 ) :
283
+ raise ValueError (
284
+ 'Integers to negative integer powers are not allowed.' )
285
285
if get_optimization () == 'aggressive' :
286
286
RANGE = 50 # Approximate break even point with pow(x,y)
287
287
# Optimize all integral and half integral powers in [-RANGE, RANGE]
You can’t perform that action at this time.
0 commit comments