title: PyTorch running out of memory: DefaultCPUAllocator can't allocate memory
body: <p>I'm trying to optimize some weighs (<code>weigts</code>) in Pytorch but I keep getting this error:</p>
  <blockquote>
  <p>RuntimeError: [enforce fail at CPUAllocator.cpp:64] . DefaultCPUAllocator: can't allocate memory: you tried to allocate 8000000000000 bytes. Error code 12 (Cannot allocate memory).</p>
  </blockquote>
  <p>Namely, things blow up when I run <code>(weights * col).sum() / weights.sum()</code>. Weights is a tensor of size (1000000,1) and col is also a tensor of size (1000000, 1). Both tensors are decently sized, but it seems odd that I'm using up all the memory in my computer (8GB) for these operations.</p>