Skip to content

Support initializing array from list of arrays #287

Closed

Description

@ccostes

Running the snippet

import mlx.core as mx
a = mx.array([1.])
b = mx.array([2.])
mx.array([a,b])

produces error

----> [4] mx.array([a,b])

ValueError: Invalid type in array initialization<class 'mlx.core.array'>.

This works with numpy, so seems like a bug in mlx.

Activity

  1. awni commented on Dec 25, 2023

    @awni
    Member

    This isn't so much a bug as a feature request. MLX is still missing a lot of features that NumPy has.

    For now you can use mx.concatenate or mx.stack. Will mark this as an feature request.

  2. changed the title [-]Error initializing array from list of arrays[/-] [+]Support initializing array from list of arrays[/+] on Dec 25, 2023
  3. ccostes commented on Dec 26, 2023

    @ccostes
    ContributorAuthor

    Got it, thanks! Will look into trying to implement it; seems like it might be straightforward.

    I'm enjoying mlx so far!

  4. wjessup commented on Dec 27, 2023

    @wjessup

    Adding on here, can this feature support initializing from a list that contains numpy arrays?

    a = mx.array( [np.array(1), np.array(1)])

  5. awni commented on Jan 8, 2024

    @awni
    Member

    This was closed in #325

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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