Consider
from dwave.optimization import Model
model = Model()
arr = np.arange(2*3*4*5).reshape(2, 3, 4, 5)
sym = model.constant(arr)
print(arr[:, 0, :, [2]].shape)
print(sym[:, 0, :, [2]].shape())
this is because we distribute the 0 index to basic indexing and [2] to advanced indexing. Basic indexing does not have a notion of what we call type 2 indexing. I.e.,
- The advanced indices are separated by a slice, Ellipsis or newaxis. For example x[arr1, :, arr2].
- The advanced indices are all next to each other. For example x[..., arr1, arr2, :] but not x[arr1, :, 1] since 1 is an advanced index in this regard.