Skip to content

Commit 5458524

Browse files
authored
4th-batch-16-函数变量未被使用 (PaddlePaddle#75756)
* 1012 * 1012
1 parent d2f4afd commit 5458524

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/auto_parallel/high_order_grad.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def __init__(self, num_sample):
8989
def __getitem__(self, index):
9090
x = np.linspace(0, 0.9, 10)
9191
y = np.linspace(0, 0.9, 10)
92+
np.random.seed(index) # Optional: Ensure reproducibility
9293
bc_value = np.random.rand(36).reshape(36, 1).astype('float32')
9394

9495
domain_space = []
@@ -100,8 +101,9 @@ def __getitem__(self, index):
100101
bc_index.append(i + 10 * j)
101102
domain_space = np.array(domain_space, dtype='float32')
102103
bc_index = np.array(bc_index, dtype='int64')
103-
104-
return domain_space, bc_index, bc_value
104+
# Return a single input point and its related information based on the index
105+
idx = index % len(domain_space)
106+
return domain_space[idx], bc_index, bc_value
105107

106108
def __len__(self):
107109
return self.num_sample

0 commit comments

Comments
 (0)