随机初始化值

import tensorflow as tf

import numpy as np

原型:randint(low, high=None, size=None, dtype='l')
'''
  当只有low时候,返回的值范围是[0,low).有low和high时候,返回值范围是[low,high).
'''
t1 = np.random.randint(2,size=10)
print(t1)
#[0 0 0 0 1 0 1 1 1 1]

t2 = np.random.randint(low=1,high=3,size=10) print(t2) #[2 1 2 1 2 2 2 1 1 2]

猜你喜欢

转载自www.cnblogs.com/logo-88/p/9087768.html
今日推荐