Lesson 7 of 7

Checkpoint: vectorize this function

Nothing new. A short mixed round, a round of real tracebacks, and one ordinary function taken apart and rebuilt without its loop.

The module claimed you would walk out able to predict the shape of a broadcast before running it, replace an explicit loop with a vectorized expression, read a shape error and name the axis that is wrong, and tell a view from a copy. This is where that gets tested.

There is no mark and nothing to pass. Every board names the idea it came from, so a wrong answer here is worth more than a right one -- it points at a paragraph to go back and read.

Nothing new is taught here, and nothing runs — every answer is the module's own rules applied by hand. There is no mark and no pass. What a wrong answer gives you instead is the name of the idea it came from, which is the only thing worth counting: not how many you missed, but which.

1 of 1

What is being checked

Four claims this module made about what you would be able to do, and one function that needs all four at once.

Nothing new is taught here. This is the module holding itself to what it said you would walk out able to do:

  • Predict the shape of any broadcast before running it. Not run it and read the answer -- say it first, and be right.
  • Replace an explicit loop with a vectorized expression. The same numbers out, with the loop gone.
  • Read a shape error and say which axis is wrong. The message gives you two shapes and no axis. The axis is yours to find.
  • Tell a view from a copy. Both print identically, and only one of them writes through to your data.

The rounds go: a mixed one that takes a question from each corner of the module; a round of real errors, where the whole job is naming the guilty axis; and a finale that takes one ordinary function apart and rebuilds it without its loop.

A wrong answer here is the useful kind. Every board says which idea it came from, in words, so a miss points at something to go back and read rather than at a score. There is no mark and no pass -- the only thing worth counting is which ideas you missed.

If you want one habit out of the whole module, it is this: before you run a line that combines two arrays, say the shape that comes out. Being wrong on paper costs a second. Being wrong in a training run costs the run, and sometimes it does not even tell you.

Challenge

Mixed Round

1 of 6

One question from each corner of the module.

No two of these are about the same thing. A dtype, a shape after a reduction, the same reduction with the axis kept, whether you are holding the original, and a broadcast. Nothing here is harder than the lesson it came from -- the difficulty is that you are not told which lesson that is.