Getting C1001 Internal compiler error when building pytorch on windows

Thanks a lot really appreciate your time and kind help.

How did you build for /MT ?

Concerning how I built the \MT . Since I could successfully create a cmake project and then a visual studio project using what I mentioned in post #2 , I went on to each single project, right clicked on each of them, went to properties, C/C++ -> Code Generation -> Runtime Library and flipped the option from MD to MT! and it successfully built the libs. although the Python_sth failed, but the main libs that I were after were successfully built.

The weird thing though was that, there were no .dlls despite the fact that I only changed the library runtime option and everything else was intact. I only got .lib files plus .exp files. I used them to successfully link my application , however for execution it needed the dll part (c10.dll for example) which shamelessly I used the prebuilt ones from Pytorch which I believe are built as MD!
I didn’t face any issues though, the app seemed to be running just fine. the lib version (static build) was fine though.
So I wanted to know is this normal or did I just messed something up ? (I have a gut feeling I did!)

How you activated the VC shell more than once?
I’m not sure, I didn’t do anything special, maybe my repeated tries resulted in that?

Anyway, your proposed change seems to be working and its being compiled now. I’ll report back how it goes.

Update:
Its finished successfully and created 247 targets!
Something to note though why is torch_cpu.lib 2.05 GB!? this is huge! :

wouldn’t this be an issue? specially in ram consumption? This is not related to libtorch anymore, but I’d really appreciate an explanation on this if possible. I know statically linking allows for only the needed parts to be loaded into ram, but this huge amount kind of scares me that lots of stuff is going to end up there (possibly as duplicates?) when I built using my first attempt, my torch_cpu.lib was around 10/20 MBs if I’m not mistaken. how come this is 2GB! is it because this is built statically and I built it dynamically? (in that case, why did I not have any .dll files accompaning the lib files like usual?)