Log inStart free
LESSON 16.24 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Functional and accelerator environments

Watch one pure step function drive a whole batch of envs on a GPU.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 16.24 · ENV BAYENV 1 · STEP 3 · POS 2 → 3
01
Stage 1 of 5 · Pure step
A functional environment keeps no hidden state. Its step takes a state and returns a new state.
Explain it simply

You see one env on the top row. Each cell is a whole state: a position, a step count and a key. The step reads one cell and writes the next cell. It never changes the cell it read, so the same call gives the same answer.

Row 1 shows env 1 over 8 steps: positions 0, 1, 2, 3, 2, 3, 4, 2, 3. The panel shows step 3: position 2 goes in and position 3 comes out.

states, env stepsgoal reachedslips, call costspolicy on the GPUreset, idle
one env over 8 stepsthe stepkeystart12345678env 11fc8012323423state in2state out3step(s, a = right) at step 3env 1: u = 0.37 ≥ 0.25, so it moves right: 2 → 3key 0387 splits into 3 new keys: next, slip, resetreward 0, done 0: state out 3one env over 8 stepsthe stepkeystart12345678env 11fc8012323423state in2state out3step(s, a = right) at step 3env 1: u = 0.37 ≥ 0.25, so it moves right: 2 → 3key 0387 splits into 3 new keys: next, slip, resetreward 0, done 0: state out 3
Toy: 4 to 16 envs in a 6-cell slippery corridor; the µs costs are illustrative
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
(st+1, r, d)=step⁡(st, a)(\sy{s}{data}{s_{t+1}},\ \sy{r}{out}{r},\ \sy{d}{out}{d}) = \operatorname{step}(\sy{s0}{data}{s_t},\ a)
pos 2→3, u=0.37≥0.25, r=0\text{pos } 2 \to 3,\ u = 0.37 \ge 0.25,\ r = 0

The step maps the old state and an action to a new state.

Common mix-ups

MYTHA batch of envs draws different random numbers by itself.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01In scan mode, does a batch of 16 envs take longer than a batch of 4?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.