Guest User

Untitled

a guest
Mar 18th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. # forward pass
  2. W = np.random.randn(5, 10)
  3. X = np.random.randn(10, 3)
  4. D = W.dot(X)
  5.  
  6. # now suppose we had the gradient on D from above in the circuit
  7. dD = np.random.randn(*D.shape) # same shape as D
  8. dW = dD.dot(X.T) #.T gives the transpose of the matrix
  9. dX = W.T.dot(dD)
Add Comment
Please, Sign In to add comment