Can't subclass torch.multiprocessing.Pool

I’m trying to subclass PyTorch’s multiprocessing.Pool class.
I’m getting this error:

TypeError: method expected 2 arguments, got 3

I was surprised what “method” was the interpreter talking about, so I’ve printed
print ( torch.multiprocessing.Pool) to see what this actually resolves to.
Instead of the usual <class ...> type I was expecting, I got:

<bound method BaseContext.Pool of <multiprocessing.context.DefaultContext object at 0x10f4bd550>>

Which took me a bit by surprise.

I’d appreciate any assistance. Thanks!

Seems like the “correct” way to subclass this class would have been to inherit from torch.multiprocessing.pool.Pool - but that’s not an option, since pool isn’t exposed in torch’s __init__.py.

So now I’m really stuck…

BTW - I did notice that torch is registering it’s reduction functions on ForkingPickler already during import torch, even if I don’t use torch’s Pool class by rather python’s usual multiprocessing.pool.Pool class.
What will happen if I’ll subclass python’s Pool directly? Would I still be able to efficiently share tensors between processes (using memory sharing, not serialization)?