Blobs are N-D tensors (for N not necessarily equals 4)

This PR gives Blobs a `vector<int>` of dimensions, rather than the old `num, channels, height, width`.  The first commit is all the changes needed to get Caffe to compile and everything to run as before with the new vector of tensor dimensions.  The remaining commits generalize some existing classes to use the new tensor dimensions (but they are not necessary to make it run, as it's still fine to just use all 4-D blobs with extra singleton dimensions where needed).

Currently I think the only problem is that in the `InnerProductLayer` the weight blobs won't be compatible with existing saved nets (since the weights are now 2D tensors and biases are 1D tensors), so I need to add something to handle that case for backwards compatibility.