Implement a function get_batch(data, block_size, batch_size, seed) that samples random training batches for next-token prediction language model training.
Given:
data: a 1D numpy array of integer token idsblock_size: context length (number of tokens per sequence)batch_size: number of sequences in the batchseed: integer seed for reproducibilityUsing rng = np.random.default_rng(seed), sample batch_size random starting offsets via rng.integers(0, len(data) - block_size, size=batch_size). For each offset i, the input row is data[i : i + block_size] and the target row is data[i + 1 : i + 1 + block_size] (shifted by one position, since we predict the next token at every position).
Return a single numpy array of shape (2, batch_size, block_size) where index 0 is the input tensor x and index 1 is the target tensor y, with integer dtype.