Hello, thanks for the reply.
I tried, but other errors showed up, namely in header files Optional.h, ScalarType.h and others.
libtorch\include\c10/util/Optional.h(277): error C2556: 'c10::ScalarType &c10::optional<c10::ScalarType>::contained_val(void) const &': overloaded function differs only by return type from 'const c10::ScalarType &c10::optional<c10::ScalarType>::contained_val(void) const &'
libtorch\include\c10/util/Optional.h(277): error C2373: 'c10::optional<c10::ScalarType>::contained_val': redefinition; different type modifiers
...

I think the changes, that caused my problems were introduced in (https://github.com/pytorch/pytorch/pull/30916 16, https://github.com/pytorch/pytorch/pull/30919 8 and probably others).
Correct me if I’m wrong, but that means there is requirement for C++14 compiler in version 1.5.0, but toolset v140 does not support entire standard --> extended constexpr (https://docs.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=vs-2019 14). So for the version 1.5.0 and future versions I have to use the newer toolset than v140?