PaddlePaddle / PaddlePaddle/Paddle

随机种子设置不起作用

Open
#57,745 0 comments 0 reactions 1 assignee View on GitHub

@GhostScreaming is already working on this.

Since Sep 26, 2023.

status/new-issue type/bug-report
Dominant language
C++
Stars
24.1k
Forks
6k
Avg merge
4d 17h
Merged PRs (30d)
60

Description

bug描述 Describe the Bug

固定随机种子:

random.seed(2021)
paddle.seed(2021)
np.random.seed(2021)

但是无法取得一致的网络初始化结果

网络设置:

seq_len = 336
label_len = 0
pred_len = 96
batch_size = 32
num_workers = 10
enc_in = 7
s = 24

import paddle
import paddle.nn as nn
import numpy as np

class MLP_encoder(nn.Layer):
def init(self, seq_len, s, hidden_len=2048):
super(MLP_encoder, self).init()
self.seq_len = seq_len
self.hidden_len = hidden_len
self.s = s
self.split = nn.Conv1D(in_channels=1, out_channels=self.s, kernel_size=self.s, stride=self.s)
self.cat = nn.Conv1DTranspose(in_channels=self.s, out_channels=1, kernel_size=self.s, stride=self.s)

def forward(self, x): # [Batch, Channel, Input length]
    B, F, L = x.shape
    x = paddle.reshape(x, [B * F, 1, L])
    x = self.split(x)
    x = self.cat(x)
    x = paddle.reshape(x, [B, F, L])
    return x # [Batch, Channel, Input length]
其他补充信息 Additional Supplementary Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.