Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions test/auto_parallel/high_order_grad.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(self, num_sample):
def __getitem__(self, index):
x = np.linspace(0, 0.9, 10)
y = np.linspace(0, 0.9, 10)
np.random.seed(index) # Optional: Ensure reproducibility
bc_value = np.random.rand(36).reshape(36, 1).astype('float32')

domain_space = []
Expand All @@ -100,8 +101,9 @@ def __getitem__(self, index):
bc_index.append(i + 10 * j)
domain_space = np.array(domain_space, dtype='float32')
bc_index = np.array(bc_index, dtype='int64')

return domain_space, bc_index, bc_value
# Return a single input point and its related information based on the index
idx = index % len(domain_space)
return domain_space[idx], bc_index, bc_value

def __len__(self):
return self.num_sample
Expand Down