FunctionRacerProblemsRace

Windows and Targets

HardPyTorchPython

To teach a model to predict the next value of a series, the series is cut into examples: every run of k values in a row is an input, and the value right after it is its target. Return two tensors for the series x: the inputs, one run per row, and the targets. A run at the very end, with nothing after it, is not an example.

Example 1

x [1.0,2.0,3.0,4.0,5.0]
k 2
returns [[[1.0,2.0],[2.0,3.0],[3.0,4.0]],[3.0,4.0,5.0]]

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More PyTorch problems