torch.split currently only splits along one dimension, so that you can’t provide different lengths for the same dim.
Do you have any constrains regarding your tensor A, i.e. will the first values always be a valid one or could there be a zero sometimes?