开发者

Gradient Descent Algorithm by Python: Why is it necessary to use "np.all"?

I referred the following page to learn gradient-descent-algortithm by Python: https://realpyt开发者_JAVA百科hon.com/gradient-descent-algorithm-python/#implementation-of-basic-gradient-descent

In the code(the 2nd Code block in the page), in line 9 and 10, there is a following code:

        if np.all(np.abs(diff) <= tolerance):
        break

But, I am not sure why it uses np.all.

I tried to removed np.all in the orignal code in the next colab file: https://colab.research.google.com/drive/13y7tszDV2eF8-q90C9wMzuX9bpc5aLQU?authuser=5#scrollTo=q0wzU2TjwJzY and, it workded well.

Could someone tell me why np.all is used in the model code in the URL above? Thank you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜