y0ast / deterministic-uncertainty-quantification

Code for "Uncertainty Estimation Using a Single Deep Deterministic Neural Network"
https://arxiv.org/abs/2003.02037
MIT License
268 stars 31 forks source link

Element 0 of tensors does not require grad and does not have a grad_fn #4

Closed KyungpilGwon closed 3 years ago

KyungpilGwon commented 3 years ago

Hi, Thank you for sharing your working codes. I want to trying your code, But i got a problem with training code

File "directory/train_duq_cifar.py", line 103, in calc_gradient_penalty gradients = calc_gradients_input(x, y_pred) File "directory/train_duq_cifar.py", line 95, in calc_gradients_input create_graph=True,

It occurred after 1epoch

As you can see line 122 of train_duq_cifar.py, Authors set the x.requiresgrad(True) for tracking the gradients

I don't know this error occurred. Could me help me? Thank you

y0ast commented 3 years ago

I have a feeling you are using ignite=0.4.3, is that true? They unfortunately broke some use cases (for more details see: https://github.com/pytorch/ignite/issues/1674). I am working on getting it resolved with them :)

In the meantime use ignite<=0.4.2.

KyungpilGwon commented 3 years ago

I have a feeling you are using ignite=0.4.3, is that true? They unfortunately broke some use cases (for more details see: pytorch/ignite#1674). I am working on getting it resolved with them :)

In the meantime use ignite<=0.4.2.

Yeah, Your right. in my environment ignite version is 0.4.3 So I downgrade it to 0.4.2 and it runs well without error

Thank you :)

y0ast commented 3 years ago

no problem!