Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoming0625 committed Jun 11, 2024
1 parent d0fcce6 commit c0f8171
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions brainunit/math/_compat_numpy_array_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ def f(*args, unit: Unit = None, **kwargs):


@wrap_array_creation_function
def full(shape: Sequence[int],
fill_value: Any,
dtype: Optional[Any] = None,
unit: Optional[Unit] = None) -> Union[Array, Quantity]:
def full(
shape: Sequence[int],
fill_value: Any,
dtype: Optional[Any] = None,
unit: Optional[Unit] = None
) -> Union[Array, Quantity]:
return jnp.full(shape, fill_value, dtype=dtype)


Expand Down Expand Up @@ -447,8 +449,6 @@ def asarray(
Returns:
Union[jax.Array, Quantity]: Quantity if `unit` is provided, else an array.
'''
from builtins import all as origin_all
from builtins import any as origin_any
if isinstance(a, Quantity):
if unit is not None:
assert isinstance(unit, Unit)
Expand Down Expand Up @@ -561,12 +561,14 @@ def arange(*args, **kwargs):


@set_module_as('brainunit.math')
def linspace(start: Union[Quantity, bst.typing.ArrayLike],
stop: Union[Quantity, bst.typing.ArrayLike],
num: int = 50,
endpoint: Optional[bool] = True,
retstep: Optional[bool] = False,
dtype: Optional[bst.typing.DTypeLike] = None) -> Union[Quantity, jax.Array]:
def linspace(
start: Union[Quantity, bst.typing.ArrayLike],
stop: Union[Quantity, bst.typing.ArrayLike],
num: int = 50,
endpoint: Optional[bool] = True,
retstep: Optional[bool] = False,
dtype: Optional[bst.typing.DTypeLike] = None
) -> Union[Quantity, jax.Array]:
'''
Return a Quantity of `linspace` and `unit`, with uninitialized values if `unit` is provided.
Expand Down

0 comments on commit c0f8171

Please sign in to comment.