Prepending singleton axis with expand_dims
There doesn't seem to be a way of prepending a singleton axis using the new expand_dims operation.
If I understand correctly, the semantics of the axis parameter is insert after (add at).
If it instead was insert at, that would allow prepending which I think would be pretty nice to have:
i = C.placeholder((7, 5))
C.expand_dims(i, axis=0) # [1, 7, 5] with "insert at"
I understand that such a change wouldn't be backwards compatible and therefore might not be possible to do.
How about C.expand_dims(x, axis=-1-len(x.shape))?
That would work, since I guess you can always ensure that you know the tensor shape. The syntax might be slightly cumbersome, but that's a minor thing.
Thank you for the help.
The solution is to use C.expand_dims(x, axis=C.Axis.new_leading_axis())