Mixing C++ and Python types

I have a number of PyTorch modules implemented in C# via C++ public API by subclassing the torch::nn::Module as DotNetModule that has a pointer to a forward function implemented in C# (via TorchSharp). I want to be able to use them from Python.

My main problem is that Python side of PyTorch has its own Tensor class, and C++ one is different (TorchSharp uses shared_ptr<torch::nn:Tensor> for this purpose. So the question is how to obtain a shared_ptr<torch::nn::Tensor> from Python so I could pass it to the DotNetModule. And once my module returns a shared_ptr<torch::nn:Tensor> back - construct a Python Tensor from it. Is it even possible without an extra C++ extension?

From the architectural point of view I don’t want the C# modules know anything about the Python client.