Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change drop_axis to default to None rather than an empty list in map_blocks #446

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions cubed/core/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,16 @@ def map_blocks(
*args: "Array",
dtype=None,
chunks=None,
drop_axis=[],
drop_axis=None,
new_axis=None,
spec=None,
**kwargs,
) -> "Array":
"""Apply a function to corresponding blocks from multiple input arrays."""

if drop_axis is None:
drop_axis = []

# Handle the case where an array is created by calling `map_blocks` with no input arrays
if len(args) == 0:
from cubed.array_api.creation_functions import empty_virtual_array
Expand Down Expand Up @@ -618,10 +621,19 @@ def wrap(*a, **kw):


def _map_blocks(
func, *args: "Array", dtype=None, chunks=None, drop_axis=[], new_axis=None, **kwargs
func,
*args: "Array",
dtype=None,
chunks=None,
drop_axis=None,
new_axis=None,
**kwargs,
) -> "Array":
# based on dask

if drop_axis is None:
drop_axis = []

new_axes = {}

if isinstance(drop_axis, Number):
Expand Down
Loading