title: backpropagation - neural network - derivate
body: <p>I'm studying backpropagation but I'm not understanding why do we need to divide the <strong>'dW_curr'</strong>
  by <strong>'m'</strong>. Every code I see they do that, but why? We only need to make this division if we're using  cross entropy  as our loss function or every single loss function?</p>
  <p>The next code is from <a href="https://towardsdatascience.com/lets-code-a-neural-network-in-plain-numpy-ae7e74410795" rel="nofollow noreferrer">https://towardsdatascience.com/lets-code-a-neural-network-in-plain-numpy-ae7e74410795</a>.</p>
  <pre><code>def single_layer_backward_propagation(dA_curr, W_curr, b_curr, Z_curr, A_prev, activation=&quot;relu&quot;):
      m = A_prev.shape[1]
      
      if activation is &quot;relu&quot;:
          backward_activation_func = relu_backward
      elif activation is &quot;sigmoid&quot;:
          backward_activation_func = sigmoid_backward
      else:
          raise Exception('Non-supported activation function')
      
      dZ_curr = backward_activation_func(dA_curr, Z_curr)
      dW_curr = np.dot(dZ_curr, A_prev.T) / m
      db_curr = np.sum(dZ_curr, axis=1, keepdims=True) / m
      dA_prev = np.dot(W_curr.T, dZ_curr)
  
      return dA_prev, dW_curr, db_curr
  </code></pre>