@@ -61,12 +61,6 @@ extension MLXArray {
6161 }
6262 }
6363
64- /// Replace the interior ctx (`mlx_array` pointer) with a new value by transferring ownership
65- @inline ( __always)
66- func update( _ ctx: mlx_array ) {
67- mlx_array_set ( & self . ctx, ctx)
68- }
69-
7064 /// allow addressing as a positive index or negative (from end) using given axis
7165 @inlinable
7266 func resolve( index: Int , axis: Int ) -> MLXArray {
@@ -161,7 +155,7 @@ extension MLXArray {
161155 . broadcast ( to: broadcastShape. asInt32)
162156
163157 let indices = [ resolve ( index: index, axis: axis) ]
164- self . update ( scattered ( indices: indices, updates: expanded, axes: [ axis. int32] ) )
158+ self . _updateInternal ( scattered ( indices: indices, updates: expanded, axes: [ axis. int32] ) )
165159 }
166160 }
167161
@@ -350,7 +344,7 @@ extension MLXArray {
350344 let update = newValue. broadcast ( to: broadcastShape) . reshaped ( updateShape)
351345
352346 let axes = arange ( axis + 1 )
353- self . update ( scattered ( indices: arrayIndices, updates: update, axes: axes) )
347+ self . _updateInternal ( scattered ( indices: arrayIndices, updates: update, axes: axes) )
354348 }
355349 }
356350
@@ -380,7 +374,7 @@ extension MLXArray {
380374 }
381375 set {
382376 if let result = updateSlice ( src: self , operations: operations, update: newValue) {
383- self . update ( result)
377+ self . _updateInternal ( result)
384378 return
385379 }
386380
@@ -393,11 +387,11 @@ extension MLXArray {
393387 var result = mlx_array_new ( )
394388 mlx_scatter (
395389 & result, self . ctx, indices_vector, update. ctx, axes, axes. count, stream. ctx)
396- self . update ( result)
390+ mlx_array_set ( & self . ctx , result)
397391 mlx_array_free ( result)
398392 return
399393 } else {
400- self . update ( update)
394+ self . _updateInternal ( update)
401395 return
402396 }
403397 }
0 commit comments