Skip to content
DeepForgeby svx
All problems
EasyDeep Learningdl-442

Chunked Prefill Remainder

Problem

Return the number of tokens in the final chunk of a chunked prefill: seq_len % chunk_size, or chunk_size when the division is exact.

The signature is chunked_prefill_remainder(seq_len, chunk_size). Return an integer.

Hint

When the remainder is zero the last chunk is full.

Test cases

case 1
in: [1000,256]
expected: 232
case 2
in: [512,256]
expected: 256
case 3
in: [100,128]
expected: 100
case 4
in: [1,1]
expected: 1
case 5
in: [768,256]
expected: 256
Starter codePython
def chunked_prefill_remainder(seq_len, chunk_size):
    # Your code here
    pass

5 test cases · run your code against them in the editor