neuralop.data.datasets.darcy.DarcyDataset

class neuralop.data.datasets.darcy.DarcyDataset(root_dir: Path | str, n_train: int, n_tests: List[int], batch_size: int, test_batch_sizes: List[int], train_resolution: int, test_resolutions: List[int] = [16, 32], encode_input: bool = False, encode_output: bool = True, encoding='channel-wise', channel_dim=1, subsampling_rate=None, dtype: dtype = torch.float32, download: bool = True)[source]

DarcyDataset stores data generated according to Darcy’s Law. Input is a coefficient function and outputs describe flow.

Data source: https://zenodo.org/records/12784353

Parameters:
root_dirUnion[Path, str]

root at which to download data files

n_trainint

number of train instances

n_testsList[int]

number of test instances per test dataset

batch_sizeint

batch size of training set

test_batch_sizesList[int]

batch size of test sets

train_resolutionint

resolution of data for training set

test_resolutionsList[int], optional

resolution of data for testing sets, by default [16,32]

encode_inputbool, optional

whether to normalize inputs in provided DataProcessor, by default False

encode_outputbool, optional

whether to normalize outputs in provided DataProcessor, by default True

encodingstr, optional

parameter for input/output normalization. Whether to normalize by channel (“channel-wise”) or by pixel (“pixel-wise”), default “channel-wise”

channel_dimint, optional

dimension of saved tensors to index data channels, by default 1

subsampling_rateint or List[int], optional

rate at which to subsample each input dimension, by default None

dtypetorch.dtype, optional

dtype to cast input tensors to after loading. The bundled Darcy coefficient fields are stored as torch.bool, so this defaults to torch.float32 to keep them usable by float models. Pass None to preserve the saved dtype. Default is torch.float32.

downloadbool, optional

whether to download data if not present, by default True

Attributes:
train_db: torch.utils.data.Dataset of training examples
test_db: “” of test examples
data_processor: neuralop.data.transforms.DataProcessor to process data examples

optional, default is None