C4 week2 assign 1

heres my error code - i just looked for similar before i posted im sure im not the first here is my error code :---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [18], in <cell line: 13>()
9 X3 = np.ones((1, 4, 4, 3)) * 3
11 X = np.concatenate((X1, X2, X3), axis = 0).astype(np.float32)
—> 13 A3 = identity_block(X, f=2, filters=[4, 4, 3],
14 initializer=lambda seed=0:constant(value=1))
15 print(‘\033[1mWith training=False\033[0m\n’)
16 A3np = A3.numpy()

Input In [16], in identity_block(X, f, filters, initializer, training, s)
48 X_shortcut = BatchNormalization(axis=3)(X_shortcut)
50 ## Final step: Add shortcut value to main path, and pass it through a RELU activation (≈2 lines)
—> 51 X = Add()([X, X_shortcut])
52 ##X = Activation(‘relu’)(X)
53 return X

File /usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py:67, in filter_traceback..error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.traceback)
—> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb

File /usr/local/lib/python3.8/dist-packages/keras/layers/merging/base_merge.py:73, in _Merge._compute_elemwise_op_output_shape(self, shape1, shape2)
71 else:
72 if i != j:
—> 73 raise ValueError(
74 ‘Inputs have incompatible shapes. ’
75 f’Received shapes {shape1} and {shape2}’)
76 output_shape.append(i)
77 return tuple(output_shape)

ValueError: Inputs have incompatible shapes. Received shapes (4, 4, 3) and (2, 2, 3)

Hi @Paul_katz ,
The error message is pointing to line Add()([X,X_shortcut]) and it says that you cannot add two variables with different shape size: (4,4,3) and (2,2,3).
Please review the previous cell that describes how the Identity block works and how to use the Add() operation. You will find where the error is located.
Keep learning!

can i send u my code - i don’t know- i don’t think i misread the criteria - i’m using (f,f) where i should i think - i see where the error code is pointing now incidentally and i did get it to output on a prior incarnate iteration. but my f2 was 46 as apposed to 192 on the f2 false output / now i’ve done so much tweaking i’m a bit spun- shapes are not compatible from cell to output immutable cell /

i just got the false results to align but still getting trace back on true

Nevrmoimd I solved this block I have a feeling im gonna be challenged every step of the way on this one thank u for trying

Hi @Paul_katz
I am happy to know you fixed the issue.
We are here to help you on this journey.
Keep learning!