Unionizing for Profit: How to Exploit the Power of Unions in C++
I’ve written a lot of unions for PyTorch this year. I’ve learned a few things along the way, and I thought a post highlighting this useful-but-little-used C++ construct might be in order. (If you know how to use unions, you may still be interested in the more advanced content toward the middle and end of the post!) What is a union? A union is like a struct, but instead of holding ALL of its members, it holds ANY single one of them. The main reason to use a union is to save on memory, which migh...
PyTorch Developer Mailing List