Repository navigation
In-place operators - #91
Conversation
7df4b93 to
00ed613
Compare
| let s = StreamOrDevice.default | ||
| let result = mlx_add(lhs.ctx, rhs.ctx, s.ctx)! | ||
| mlx_free(lhs.ctx) | ||
| lhs.ctx = result |
There was a problem hiding this comment.
Please use this function:
/// Replace the contents with a reference to a new array.
public func update(_ array: MLXArray) {
if array.ctx != self.ctx {
mlx_retain(array.ctx)
mlx_free(ctx)
self.ctx = array.ctx
}
}Possibly make a package scoped variant that takes an mlx_array instead of MLXArray. These self-mutates are rare and it is good to have them go through a common method.
There was a problem hiding this comment.
OK, I have made the changes and pushed.
00ed613 to
24d3f5f
Compare
24d3f5f to
96f5b7d
Compare
|
I noticed there is a bug around swift-docc that could not generate symbol links for For this PR, I want to keep it as simple and focused as possible, so I will continue to document in the previous manner. And I will make a follow-up PR to address this problem. |
davidkoski
left a comment
There was a problem hiding this comment.
Looks great, thanks for this! I think it is a good addition.
Fix #86