title: multiprocessing and torch.tensor, Cannot allocate memory error
body: <p>Consider the simple example in the following, if I return a list at <code>func</code>, there will be no error,
  if I return a <code>torch.tensor</code> I will get this error:</p>
  <pre class="lang-sh prettyprint-override"><code>/work/aten/src/ATen/MapAllocator.cpp&quot;:263, please report a bug to PyTorch. unable to open shared memory object &lt;/torch_326297_506&gt; in read-write mode')'
  </code></pre>
  <p>and If it use  <code>set_sharing_strategy</code>, to avoid this error:</p>
  <pre class="lang-py prettyprint-override"><code>from multiprocessing import Pool
  from time import sleep
  import torch
  
  
  class A:
      def __init__(self, n_job, N):
          self.n_job = n_job
          self.N = N
  
      
      def func(self, i):
          # sleep(1)
          print(i)
          return torch.as_tensor([i])
          # return [i]
  
      data = []
  
      def read(self):
  
          torch.multiprocessing.set_sharing_strategy('file_system')
  
          with Pool(processes=self.n_job) as pool:
              data = pool.map(self.func, range(self.N))
      
          return data
      
  if __name__ == &quot;__main__&quot;:
      a = A(10, 2**16)
      data = a.read()
  
  
      print(len(data))
  </code></pre>
  <p>I get another error says</p>
  <pre class="lang-sh prettyprint-override"><code>MapAllocator.cpp&quot;:323, please report a bug to PyTorch. unable to mmap 72 bytes from file &lt;/torch_326588_5707&gt;: Cannot allocate memory (12)
  </code></pre>
  <p>is there any solution?
  I need to return the tensor, so just removing the tensor is not an option.</p>