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

[FEATURE] mx.repeat with variable number of repetitions #1785

Open
kyrollosyanny opened this issue Jan 21, 2025 · 0 comments
Open

[FEATURE] mx.repeat with variable number of repetitions #1785

kyrollosyanny opened this issue Jan 21, 2025 · 0 comments

Comments

@kyrollosyanny
Copy link

Describe the bug
In numpy, np.repeat can accept both int and array type for the repetition. The main use case for passing an array is if each element in the original array needs to repeated a different number of times. Currently, this fails in MLX.

To Reproduce
In numpy:

a=np.array([1,2,3,4])

print(np.repeat(a,a))

[1 2 2 3 3 3 4 4 4 4]

in MlX, this does not work since repetition needs to be an integer.

It would be great if we can add this behavior to mx.repeat unless there is another efficient way to do this.

Thanks

@angeloskath angeloskath changed the title [BUG] mlx.repeat does not behave similary to np.array when repetition is an array [FEATURE] mx.repeat with variable number of repetitions Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant