Learn Before
Debugging a Sequence Slicing Function
A programmer is implementing a function to extract a 'context window' of n items from a long sequence. The window should end at the current position, i. The programmer's code uses i - n as the starting index for the slice. Explain why this calculation is incorrect and what the correct starting index expression should be.
0
1
Tags
Ch.2 Generative Models - Foundations of Large Language Models
Foundations of Large Language Models
Computing Sciences
Foundations of Large Language Models Course
Analysis in Bloom's Taxonomy
Cognitive Psychology
Psychology
Social Science
Empirical Science
Science
Related
Vector Slice Notation for a Sequence Window ()
Matrix Slice Notation for a Sequence Window ()
A process is analyzing a sequence of data points,
[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], which are indexed starting from 0. The process needs to select a window ofn=5consecutive elements. If the last element of the window is at indexi=7, which of the following sub-sequences represents the correct window of data?Debugging a Sequence Slicing Function
An algorithm processes a long sequence of data by examining a 'window' of
n=10consecutive elements at a time. If the algorithm is currently focused on the specific window of elements from index 90 to index 99 (inclusive), then the variableirepresenting the end-point of the current window would be 100.