Query regarding Gradient descent

You can check these codes to get the intuition. Read this on how to find the source for utility functions invoked by the notebook.