https://docs.scipy.org/doc/numpy-1.16.1/reference/generated/numpy.ones.html?highlight=ones
numpy.ones(shape, dtype=None, order=’C’)
Return a new array of given shape and type, filled with ones.
例子
1 | np.ones(5) |
1 | np.ones((5,), dtype=int) |
1 | np.ones((2, 1)) |
1 | s = (2,2) |