read.cash Log in
h@hbkedge

龍家俊教你 機器學習 day27 #生成數組的方法 ## 生成0和1的數組 np.ones(shape, dtype) np.ones_like(a, dtype) np.zeros(shape, dtype) np.zeros_like(a, dtype) ones = np.ones([4,8]) ones 返回結果: array([[1., 1., 1., 1., 1., 1., 1., 1.], [1., 1., 1., 1., 1., 1., 1., 1.], [1., 1., 1., 1., 1., 1., 1., 1.], [1., 1., 1., 1., 1., 1., 1., 1.]]) np.zeros_like(ones) 返回結果: array([[0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0., 0., 0.]])

No comments yet

Log in to join in Reading is open to everyone. Replying needs an account.