Multiply with partial tiles
Compute a matrix product while handling incomplete inner tiles.
What’s going wrong
Original LLM Architecture lab. This CUDA fundamentals exercise is a deterministic Python simulation, not CUDA code or GPU execution. Implement solve(data) using the Python standard library.
Given rectangular matrices a and b with compatible dimensions and a positive tile_size, return {"product": matrix}. Compute each output as the sum over the shared dimension, processing that dimension in chunks of tile_size and including the final partial chunk. a has at least one row; b may be empty only when the shared dimension is zero. If b is empty, each output row is empty.
Expected behavior
Compute a matrix product while handling incomplete inner tiles.
Reproduction
{"a": [[1, 2, 3]], "b": [[1], [2], [3]], "tile_size": 2}{"product": [[14]]}{"a": [[1, 2]], "b": [[2], [3]], "tile_size": 2}{"product": [[8]]}{"a": [[]], "b": [], "tile_size": 2}{"product": [[]]}Before you begin
- Python lists and loops
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.