fix test_mobile_net random failed test=develop (#25364)

fix_copy_if_different
Aurelius84 5 years ago committed by GitHub
parent a3dfff51ad
commit bdad383c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -407,12 +407,14 @@ def create_optimizer(args, parameter_list):
return optimizer return optimizer
def fake_data_reader(batch_size, lable_size): def fake_data_reader(batch_size, label_size):
local_random = np.random.RandomState(SEED)
def reader(): def reader():
batch_data = [] batch_data = []
while True: while True:
img = np.random.random([3, 224, 224]).astype('float32') img = local_random.random_sample([3, 224, 224]).astype('float32')
label = np.random.randint(0, lable_size, [1]).astype('int64') label = local_random.randint(0, label_size, [1]).astype('int64')
batch_data.append([img, label]) batch_data.append([img, label])
if len(batch_data) == batch_size: if len(batch_data) == batch_size:
yield batch_data yield batch_data

Loading…
Cancel
Save