We don’t support forwarding arbitrary C++ object as a tensor through the network at the moment. I’d recommend opening a feature request at https://github.com/pytorch/pytorch/issues for us to better understand your use case. Thanks!