In the function initialize_parameters() where w is created, check the parameters pass to the random generator. It should be n_y, n_x, giving w with shape (1246, 2)
To calculate Z, we are doing an array multiplication, so it is the @ operator, the dot product operation. The * is an elementwise multiplication operation.