carlos-gg / dl4ds

Deep Learning for empirical DownScaling. Python package with state-of-the-art and novel deep learning algorithms for empirical/statistical downscaling of gridded data
https://carlos-gg.github.io/dl4ds/
Apache License 2.0
83 stars 26 forks source link

Error when dimension mistmatch between static variable and predictand #2

Open brandi-giuseppe opened 1 year ago

brandi-giuseppe commented 1 year ago

Hi,

I am playing with the code, and when I input a static variable of higher resolution than the predictand, I get an error.

The code I run is:

ARCH_PARAMS = dict(n_filters=4, n_blocks=4, normalization=None, dropout_rate=0.0, dropout_variant='spatial', attention=False, activation='relu', localcon_layer=True)

trainer = dds.SupervisedTrainer( backbone='resnet', upsampling='spc', data_train=y_train, data_val=y_val, data_test=y_test, data_train_lr=x_train,#None, # here you can pass the LR dataset for training with explicit paired samples data_val_lr=x_val,#None, # here you can pass the LR dataset for training with explicit paired samples data_test_lr=x_test,#None, # here you can pass the LR dataset for training with explicit paired samples scale=2, time_window=None, static_vars=[elevation],#None, predictors_train=[z_pr_train], predictors_val=[z_pr_val], predictors_test=[z_pr_test], interpolation='inter_area', patch_size=None, batch_size=8, loss='mae', epochs=50, steps_per_epoch=None, validation_steps=None, test_steps=None, learning_rate=(2e-3, 2e-4), lr_decay_after=2e4, early_stopping=True, patience=6, min_delta=0, save=False, save_path=None, show_plot=True, verbose=True, device='CPU', **ARCH_PARAMS)

trainer.run()

And the error I get is:

InvalidArgumentError: Graph execution error:

Node: 'gradient_tape/resnet_spc/concatenate_9/ConcatOffset' All dimensions except 3 must match. Input 1 has shape [8 3600 7200 16] and doesn't match input 0 with shape [8 192 384 18]. [[{{node gradient_tape/resnet_spc/concatenate_9/ConcatOffset}}]] [Op:__inference_train_function_34190]

The error disappears if the static variable is of the same size as the HR predictand.