简体   繁体   中英

TypeError: backward() got an unexpected keyword argument 'variables'

I am using the recurrent Gaussian Process library . I believe the code is developed by older versions of python and pytorch. I ran one of the experiments of the model after cloning the repository

python ./testing/rnn_rgp_test.py

I got this error message from this line of the rnn_encoder.py script :

./RGP/autoreg/rnn_encoder.py", line 274, in backward_computation
    torch.autograd.backward( variables=self.forward_means_list + self.forward_vars_list, 
TypeError: backward() got an unexpected keyword argument 'variables'

I will be grateful if someone can point out how I can fix this error?

Version 0.3.1 of PyTorch seems to be the last version with the variables parameter. Ideally, the RGP library should have documented which version of their dependencies they use but they didn't. Given that their Git repo seems to be inactive, you have several choices:

  1. Use old versions of whatever libraries they require. You will have to go from one error to the next, hoping that things work as intended.
  2. Fork RGP and re-implement the logic with current libraries. This will likely involve significant coding and may not even be possible at all.
  3. Try to find a different library that implements RGPs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM