Skip to content

Disallow np.array(COO) #218

@hameerabbasi

Description

@hameerabbasi

Currently, we have a mix of when to allow dense inputs and when not to allow them. Currently, we have the __array__ protocol which converts the sparse array into a dense one when using np.array(COO) or similar.

This would be fine if we knew that we were densifying, but in practice, we really don't. Think of something that calls np.asarray internally, this would densify, and in many cases fill up memory and raise a MemoryError.

In practice, what we want most of the time is to disallow np.[as]array(COO) and provide an explicit escape hatch in the form of COO.todense().

Recently, I added an environment variable to control this, so this discussion is mostly about changing the default behaviour.

Thoughts, @rgommers, @shoyer, @mrocklin, @perimosocordiae?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions