Recommended method for control flow with mlx types #1375
Answered
by
angeloskath
kyrollosyanny
asked this question in
Q&A
-
|
Given that mlx uses lazy evaluation, using mlx arrays for control flow can be very inefficient. I was wondering if there is a recommended way for doing something as below: Thanks a lot for the great package. |
Beta Was this translation helpful? Give feedback.
Answered by
angeloskath
Aug 29, 2024
Replies: 1 comment 1 reply
-
|
The way would be using a = mx.array(5)
s = mx.where(a == 0, mx.array(5), 1/a) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kyrollosyanny
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The way would be using
mx.whereas follows