The following code snippet works fine! it gives the right output :
[0]
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
import torch.multiprocessing as mp
import torch

def put(t):
    q.put(t)

def print_queue():
    while True:
        print(q.get())

if __name__ == '__main__':
    q = mp.Queue()
    proc_put_list = []
    for i in range(10):
        proc_put = mp.Process(target=put, args=([i], ))
        proc_put_list.append(proc_put)
        proc_put.start()

    for p in proc_put_list:
        p.join()

    while not q.empty():
        print(q.get())

However, if I change

    proc_put = mp.Process(target=put, args=([i], ))


to

    proc_put = mp.Process(target=put, args=(torch.tensor([i]), ))


It gives the following error:
Traceback (most recent call last):
  File "python_mp.py", line 27, in <module>
    print(q.get())
  File "/usr/lib64/python3.6/multiprocessing/queues.py", line 113, in get
    return _ForkingPickler.loads(res)
  File "/usr/local/lib64/python3.6/site-packages/torch/multiprocessing/reductions.py", line 276, in rebuild_storage_fd
    fd = df.detach()
  File "/usr/lib64/python3.6/multiprocessing/resource_sharer.py", line 57, in detach
    with _resource_sharer.get_connection(self._id) as conn:
  File "/usr/lib64/python3.6/multiprocessing/resource_sharer.py", line 87, in get_connection
    c = Client(address, authkey=process.current_process().authkey)
  File "/usr/lib64/python3.6/multiprocessing/connection.py", line 487, in Client
    c = SocketClient(address)
  File "/usr/lib64/python3.6/multiprocessing/connection.py", line 614, in SocketClient
    s.connect(address)

So my question is: can’t put torch.tensor in torch.multiprocess.queue?