Paddle: fixed random seed

Let’s take a look at the pytorch version first

import random
import numpy as np

import torch
import torch.backends.cudnn as cudnn
cudnn.benchmark = True

manual_seed = 94821
random.seed(manual_seed)
np.random.seed(manual_seed)
torch.manual_seed(manual_seed)
torch.cuda.manual_seed_all(manual_seed)

Take another look at the paddle version

import paddle
gen = paddle.seed(102)

Official screenshot:

 Reference links:

1: seed-API Document-PaddlePaddle Deep Learning Platform

Guess you like

Origin blog.csdn.net/lilai619/article/details/128580443