You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for your pioneering work on the FDS approach for addressing imbalanced regression problems. I have been applying FDS to my own network, but I encountered an issue with PyTorch, specifically the error: "RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation."
After some debugging, I suspect that the calibrate_mean_var method (defined at Line 97 in ./agedb-dir/utils.py) might be causing this issue. The error seems to be linked to an in-place operation that disrupts the gradient computation for the features variable used in the smooth method (Line 124 in ./agedb-dir/FDS.py).
The issue appears when 0 is present in v1, leading to the creation of the valid mask to avoid division by zero. The line matrix"[:, valid] = (matrix[:, valid] - m1[valid]) * torch.sqrt(factor) + m2[valid]" performs slice assignment, which is generally considered an in-place operation in PyTorch.
A potential solution to avoid this in-place operation could be to compute the smoothed matrix in one step and return it without modifying matrix directly, just as the line of return in the original code.
Could you please share your thoughts on this approach or suggest an alternative solution?
Thank you for your attention to this matter. I look forward to your response.
The text was updated successfully, but these errors were encountered:
Thank you for your pioneering work on the FDS approach for addressing imbalanced regression problems. I have been applying FDS to my own network, but I encountered an issue with PyTorch, specifically the error: "RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation."
After some debugging, I suspect that the calibrate_mean_var method (defined at Line 97 in ./agedb-dir/utils.py) might be causing this issue. The error seems to be linked to an in-place operation that disrupts the gradient computation for the features variable used in the smooth method (Line 124 in ./agedb-dir/FDS.py).
Here is the relevant code for calibrate_mean_var:
The issue appears when 0 is present in v1, leading to the creation of the valid mask to avoid division by zero. The line matrix"[:, valid] = (matrix[:, valid] - m1[valid]) * torch.sqrt(factor) + m2[valid]" performs slice assignment, which is generally considered an in-place operation in PyTorch.
A potential solution to avoid this in-place operation could be to compute the smoothed matrix in one step and return it without modifying matrix directly, just as the line of return in the original code.
Could you please share your thoughts on this approach or suggest an alternative solution?
Thank you for your attention to this matter. I look forward to your response.
The text was updated successfully, but these errors were encountered: