LibTorch 2.0.1 scripting in Debug mode on Windows
Labels: module: windows, module: cpp, triaged

### 🐛 Describe the bug

I've saved a basic model in Python and I can load and execute it fine in Visual Studio 2022 Preview in the Release mode. However, it asserts at various points in the Debug mode when forward is called. 

I'm using libtorch-win-shared-with-deps-debug-2.0.1+cu118.zip. I've tried both CPU and CUDA models/inputs and they both assert. I've tried both my own setup and the setup created by this plugin https://github.com/mszhanyi/VSIXTorch. I double-checked the paths to .lib files and copied DLLs to the Debug directory directly.

Executing tensor calculation works fine in Debug. I haven't tried compiling libtorch myself yet.

Errors when executing from the plugin:
```
Assertion failed: nthr_ == nthr, file C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\third_party\ideep\mkl-dnn\third_party\oneDNN\src\common/dnnl_thread.hpp, line 308
```

And from my setup:
```
 	torch_cpu.dll!operator delete(void * block) Line 38	C++
 	torch_cpu.dll!operator delete(void * block, unsigned __int64 __formal) Line 32	C++
 	torch_cpu.dll!std::_Deallocate<16,0>(void * _Ptr, unsigned __int64 _Bytes) Line 255	C++
 	torch_cpu.dll!std::allocator<c10::IValue>::deallocate(c10::IValue * const _Ptr, const unsigned __int64 _Count) Line 831	C++
 	torch_cpu.dll!std::vector<c10::IValue,std::allocator<c10::IValue>>::_Change_array(c10::IValue * const _Newvec, const unsigned __int64 _Newsize, const unsigned __int64 _Newcapacity) Line 2092	C++
 	torch_cpu.dll!std::vector<c10::IValue,std::allocator<c10::IValue>>::_Emplace_reallocate<c10::IValue>(c10::IValue * const _Whereptr, c10::IValue && <_Val_0>) Line 920	C++
 	torch_cpu.dll!std::vector<c10::IValue,std::allocator<c10::IValue>>::emplace<c10::IValue>(std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<c10::IValue>>> _Where, c10::IValue && <_Val_0>) Line 1062	C++
 	torch_cpu.dll!std::vector<c10::IValue,std::allocator<c10::IValue>>::insert(std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<c10::IValue>>> _Where, c10::IValue && _Val) Line 1070	C++
>	torch_cpu.dll!torch::jit::Method::operator()(std::vector<c10::IValue,std::allocator<c10::IValue>> stack, const std::unordered_map<std::string,c10::IValue,std::hash<std::string>,std::equal_to<std::string>,std::allocator<std::pair<std::string const ,c10::IValue>>> & kwargs) Line 206	C++
 	torch_cpu.dll!torch::jit::Module::forward(std::vector<c10::IValue,std::allocator<c10::IValue>> inputs, const std::unordered_map<std::string,c10::IValue,std::hash<std::string>,std::equal_to<std::string>,std::allocator<std::pair<std::string const ,c10::IValue>>> & kwargs) Line 114	C++
```

```
  torch::jit::script::Module module = torch::jit::load("u:/modules/mod.pt");
  std::vector<torch::jit::IValue> inputs;
  inputs.push_back(torch::rand({ 3, 55 }));
  at::Tensor output = module.forward(inputs).toTensor();
  std::cout << output << std::endl;
```

Update: I've replaced the CUDA libtorch version with https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-debug-2.0.1%2Bcpu.zip and it also asserts the same as the CUDA version. I also tried the nightly https://download.pytorch.org/libtorch/nightly/cpu/libtorch-win-shared-with-deps-debug-latest.zip with the same result.

### Versions

Couldn't download the script at the moment. Windows 10. 

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @vladimir-aubrecht @iremyux @Blackhex @cristianPanaite @jbschlosser