You should use the array's strides
to calculate the indices.
If the array has shape [A, B, C, D]
then the correct index is:
a * strides[0] + b * strides[1] + c * strides[2] + d * strides[3]
However, you can also simply do:
mlInput[[a, b, c, d] as [NSNumber]] = value
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…