Skip to content

Commit

Permalink
Update _compat_numpy_funcs_bit_operation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Routhleck committed Jun 11, 2024
1 parent 08b90cd commit d702944
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion brainunit/math/_compat_numpy_funcs_bit_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import jax.numpy as jnp
import numpy as np
from jax import Array
from numpy import number

from .._base import (Quantity,
)
Expand Down Expand Up @@ -91,7 +92,7 @@ def wrap_elementwise_bit_operation_binary(func):
def f(x, y, *args, **kwargs):
if isinstance(x, Quantity) or isinstance(y, Quantity):
raise ValueError(f'Expected integers, got {x} and {y}')
elif isinstance(x, (jax.Array, np.ndarray)) and isinstance(y, (jax.Array, np.ndarray)):
elif isinstance(x, (jax.Array, np.ndarray)) and isinstance(y, (jax.Array, np.ndarray, number)):
return func(x, y, *args, **kwargs)
else:
raise ValueError(f'Unsupported types {type(x)} and {type(y)} for {func.__name__}')
Expand Down

0 comments on commit d702944

Please sign in to comment.