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
      84 of 114

      Output size

      An image model slides a square window over a picture, and each place it stops makes one pixel of a new picture. The window is window pixels wide, pad blank pixels are added at both ends of the picture first, and the window moves step pixels each time. Write out_size(n, window, pad, step): along one side of the picture, n pixels long, how many places does the window stop? That’s how big the new picture is that way.

      A pixel invader, 13 across and 10 down. An image model slides a 3 × 3 window over it and makes one new pixel at each stop. The obvious count, one stop for every pixel, runs off the edges. The goal is a new picture like the one it ends on. Your out_size says how many stops fit along one side.

      A picture is a grid of pixels: this invader is 13 across and 10 down.the invaderthe new picture
      Your functionout_size(n, window, pad, step)
      nhow many pixels long one side of the picture is (13 across, 10 down)e.g. 13
      windowhow many pixels wide the square window ise.g. 3
      padhow many blank pixels are added at each end before it slidese.g. 0
      stephow many pixels the window moves each timee.g. 1
      returnshow many places along this side the window stops
      solution.pyLoading Python
      Sign in for an AI hint
      ← Did it see the ear?Far looks smaller →