The error is raised as it seems your custom Dataset is returning samples with a variable shape, which will fail in the default collate_fn in the DataLoader when the batch is created via torch.stack.
You would have to make sure to return samples with an equal length (e.g. by padding, slicing etc.) or you could use a custom collate_fn, which would create a list of samples instead of a tensor.
In the latter case you would then have to check if your model is able to process a list of inputs or if other steps are necessary.