Torch::save throws std::bad_alloc error. Advice?

I am a longtime python user who is now trying to save a tensor in c++. I am simply running the following code:

torch::Tensor a = torch::zeros({ 2,3 });
torch::save(a, "");

I am thrown the following error: “std::bad_alloc error”, followed by a hexadecimal memory address. This is the exact error message:

Unhandled exception at 0x00007FF8AC46D759 in CStack.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x00000053318FF290.

I believe that I have configured my CMake appropriately because I can create tensors without error (as well as perform other functions on the tensors).

I am coding in visual studio, and I would appreciate any advice that you have to offer. Thank you!

Figured it out – Had to switch the compiler from debug mode to release mode within visual studio. I hope that this post helps anyone else experiencing the same problem!