Mnih et al. (2013) do not feed raw colour screens to their network. A function turns the history of screens into one input: each of the last four frames is converted to gray-scale, down-sampled to and cropped to an square, and the four results are stacked. Implement .
Implement phi(frames, top).
Inputs
frames: a list (length at least 1) of the RGB screens of one episode so far, oldest first. Each is array-like of shape (H, W, 3) holding pixel intensities (Atari screens use 0 to 255). Atari screens are ; the tests also use other sizes, so read H and W from the frame.top: the first row of the crop in the down-sampled image, an int with top .Per frame
top to top + 83 of the down-sampled image, all 84 columns.Stacking. Use the last four frames of the list. If the list has fewer than four, repeat its earliest frame at the front until there are four. The stack is ordered oldest first: index 0 is the oldest frame used, index 3 the newest.
Output: a NumPy float array of shape (4, 84, 84).