Skip to content

Conversation

@FilippoOlivo
Copy link
Member

@FilippoOlivo FilippoOlivo commented Mar 24, 2025

In this PR, I fix a bug in get_all_data function in Dataset. The code for reproducing the issue is the following

input=torch.stack([torch.zeros((1,))+i for i in range(1000)])
target=input
problem = SupervisedProblem(input,target)
datamodule = PinaDataModule(problem,
        train_size=0.7,
        test_size=0.2,
        val_size=0.1,
        batch_size=64,
        shuffle=False,
        repeat=False,
        automatic_batching=None,
        num_workers=0,
        pin_memory=False,)
datamodule.setup('fit')
datamodule.setup('test')
print()
print('Using batch_size 64')
print(f'{(len(datamodule.train_dataset)==700)=}')
print(f'{(len(datamodule.test_dataset)==200)=}')
print(f'{(len(datamodule.val_dataset)==100)=}')
print()
print(f'{(len(datamodule.train_dataset.get_all_data()["data"]["input"])==700)=}')  # <==== False but must be True
print(f'{(len(datamodule.test_dataset.get_all_data()["data"]["input"])==200)=}')   # <==== False but must be True
print(f'{(len(datamodule.val_dataset.get_all_data()["data"]["input"])==100)=}')    # <==== False but must be True

Moreover, I remove a useless shuffle operation in PinaDataModule when creating the Dataloader (shuffle has already been performed). Finally, I improve the test of both dataset and datamodule classes.

@FilippoOlivo FilippoOlivo self-assigned this Mar 24, 2025
@FilippoOlivo FilippoOlivo added bug Something isn't working pr-to-review Label for PR that are ready to been reviewed labels Mar 24, 2025
@FilippoOlivo FilippoOlivo added the high priority Higher priority label Mar 24, 2025
@FilippoOlivo FilippoOlivo merged commit ef29f0a into mathLab:master Mar 25, 2025
18 of 19 checks passed
@FilippoOlivo FilippoOlivo deleted the master_upstream branch March 25, 2025 11:18
MatteB03 pushed a commit to MatteB03/PINA that referenced this pull request Mar 31, 2025
FilippoOlivo added a commit to FilippoOlivo/PINA that referenced this pull request Apr 17, 2025
GiovanniCanali pushed a commit to GiovanniCanali/PINA that referenced this pull request Dec 2, 2025
GiovanniCanali pushed a commit to GiovanniCanali/PINA that referenced this pull request Dec 2, 2025
GiovanniCanali pushed a commit to GiovanniCanali/PINA that referenced this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working high priority Higher priority pr-to-review Label for PR that are ready to been reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants