a = mx.nd.array(np.arange(9).reshape(3,3))
b = a[0:1,0:1]
c = a[:]
a[0:1,0:1] = 10
print(a)
print(b)
print(c)
The above result it
[[10. 1. 2.]
[ 3. 4. 5.]
[ 6. 7. 8.]]
<NDArray 3x3 @cpu(0)>
[[0.]]
<NDArray 1x1 @cpu(0)>
[[10. 1. 2.]
[ 3. 4. 5.]
[ 6. 7. 8.]]
<NDArray 3x3 @cpu(0)>
If a
were a numpy array, the second result was [[10.]]
rather than [[0.]]
. Is this a bug or a feature? I couldn’t find any documentation on this behavior.
Another question is whether slice
and slice_axis
methods have any advantage over the slicing syntax.
Thank you.