Pytorch Version 1.6.0 Broke LBFGS Optimizer


I am building a Libtorch implementation of Neural Style Transfer based on GitHub - andrew98450/Style-Transfer: Style Transfer using libtorch C++ Frontend

This was written before Pytorch 1.6.0, and it works fine with Pytorch 1.4.0, 1.5.0, or 1.5.1. But if I try to use it with version 1.6.0 and above, the program throws an exception right after the lambda function returns the loss (and hence, right as the optimizer takes a step). At line 13 in WrapFunctionIntoFunctor.h: “c10::Error at memory location 0x00000029AECFCF10.”

For some reason, the error is also times at WrapFunctionIntoRuntimeFunctor.h memory error on line 18 and in lbfgs.cpp, even in (seemingly) the same conditions.

It works fine with the Adam optimizer in all versions.

Any hints would be appreciated. I couldn’t find any commits on the 1.6.0 release that seemed relevant, but it must be there.

I am on Windows and have tried this with both CUDA and CPU (I modified the code to use CPU). I am happy to provide any other potentially helpful information.

Would you mind creating an issue on GitHub with this description and a reproducible code snippet, if possible, please?