thuml / Anomaly-Transformer

About Code release for "Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy" (ICLR 2022 Spotlight), https://openreview.net/forum?id=LzQQ89U1qm_
MIT License
758 stars 199 forks source link

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation #3

Closed Naji-Najari closed 2 years ago

Naji-Najari commented 2 years ago

Hello, When I run bash ./scripts/MSL.sh, I get the following error: Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [512, 55]], which is output 0 of AsStridedBackward0, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

wuhaixu2016 commented 2 years ago

Hi, thanks for your interest. You can try pytorch 1.4.0. It works well in this environment.

Naji-Najari commented 2 years ago

Than you for your reply. But, I got the same error with pytorch 1.4.0 !