Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      57 of 88

      Same step, smaller batches

      You want to train on batches of 32 photos, but only 8 fit in memory at once. So you run small batches one after another, and each reports the average slope over its own photos (the slope from “Walk downhill”). Write big_batch_slope(batch_slopes, batch_sizes): the slope one big batch of all those photos would give, so the step you take is the same.

      batch_slopes: each batch’s average slope
      batch 1batch 2batch 3batch 4
      1232
      batch_sizes: photos in each batch
      batch 1batch 2batch 3batch 4
      8888
      solution.pyLoading Python
      ← One step size per directionProtect what matters →