Cannot run final assignment for Course 1

There’s some problem with the notebook. It all runs fine until this block (written by the class, not me), and then blurps out the following error:

It’s this code that breaks:
X_norm_with_batch_dimension = np.expand_dims(X_norm, axis=0)
patch_pred = model.predict(X_norm_with_batch_dimension)


ValueError Traceback (most recent call last) in () 1 X_norm_with_batch_dimension = np.expand_dims(X_norm, axis=0)----> 2patch_pred = model.predict(X_norm_with_batch_dimension)/opt/conda/lib/python3.6/site-packages/keras/engine/training.py in predict(self, x, batch_size, verbose, steps, callbacks, max_queue_size, workers, use_multiprocessing) 1439 1440# Case 2: Symbolic tensors or Numpy array-like.-> 1441x, _, _ = self._standardize_user_data(x) 1442if self.stateful: 1443if x[0].shape[0]> batch_size and x[0].shape[0]% batch_size !=0:/opt/conda/lib/python3.6/site-packages/keras/engine/training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, check_array_lengths, batch_size) 577 feed_input_shapes, 578 check_batch_axis=False,# Don’t enforce the batch size.–> 579 exception_prefix=‘input’) 580 581if y isnotNone:/opt/conda/lib/python3.6/site-packages/keras/engine/training_utils.py in standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix) 143’: expected ‘+ names[i]+’ to have shape ‘+ 144 str(shape)+’ but got array with shape '±-> 145 str(data_shape)) 146return data 147
ValueError: Error when checking input: expected input_2 to have shape (4, 160, 160, 16) but got array with shape (160, 160, 160, 160)

Can you trace back to where X_norm was created? What is its shape at that point? Any resemblance to either of the shapes displayed in the error message?

I see you’re trying to get me to debug the problem. But this block of code is what came with the notebook. Is it actually part of the assignment, to try to figure out what’s wrong with that block?

It is if your code created X_norm and it’s the wrong shape. Maybe your implementation of standardize() for example, or further back in get_sub_volume(). And I’m not trying to get you to do anything, merely suggesting paths along which you could reason about why that error is showing up. Cheers.