Week 1 Exercise 3 : Matrix Visualization

Thanks for the excellent pictures! We are visual thinkers, so that always helps. Of course our vision is geared to 3 dimensions, so it’s challenging to visualize things in 4 or more dimensions, which is the nub of the issue here.

Let’s talk terminology first. A matrix is by definition a 2 dimensional array. An array may have an arbitrary number of dimensions. So we have this containment relationship:

vectors \subset matrices \subset arrays

By analogy, every square is a rectangle, but not every rectangle is a square, right? Every vector is a matrix, but not every matrix is a vector.

We will soon start using TensorFlow and there the terminology changes to call arrays “tensors”. So we are dealing with 4D arrays or 4D tensors here.

Now to your real question: The key point is that how you visualize them does not have to be the same just because they have the same number of dimensions. It depends on the meaning of the various dimensions. In the case of the input sample arrays, the first dimension is the “samples” dimension, so it makes perfect sense to simplify by eliding the first dimension and thinking of it as an array of m 3D tensors of shape h x w x nC_{prev}. But in the case of the W 4D arrays, we use them differently: the first 3 dimensions of W match the last three dimensions of A, so it makes the most sense to think of W as 8 of the 3D arrays with the shape h x w x nC_{prev}.

2 Likes