What is the best way to chunk up a tensor into fixed size chunks with a specified overlap?

So given a tensor T with a shape (for example) W=10,254, target chunksize of C=500 and overlap O=100 create a tensor Q with shape (B, C) where Q[0], Q[1], … is T[0:500], T[400:900], and Q[-1] is padded with a specified value.