What is the symbolic equivalent of array[x:]?

symbol
how-to
#1

I can slice an NDArray with the following code: array[x:]. How can I do this using symbolic operators?

I know there is sym.slice(begin=x, end=?), but I need to explicitely specify the end index which I do not know.

Any ideas how I can slice from an index to the very end?

#2

The end argument for the slice method can accept (None, None) to slice an array/variable to the very end. This is true for both the NDArray and Symbolic slice method.

#3

Ah I actually tried that and I got the following error message:

MXNetError: Invalid Parameter format for end expect Shape(tuple) but value=‘None’, in operator slice(name="", step=“1”, end=“None”, begin=“1”)

Then I realized I have use end=(None,) and it worked. Thanks for the help!

#4

No worries! End value just has to match begin value’s dim. so if your begin value was set to (1, 1) then your end has to be (None, None). The value has to be a tuple though!