Pass custom objects to autograd functions

I’d like to pass a custom object as undifferentiable input (tuple of tensors representing batched list of ROIs) to a custom (ROI pooling) Function’s new-style forward. In practice, this object in my case would be a tuple of tensors, but unfortunately a Variable can’t hold non-tensors. Is there a nice way to do it without resorting to workarounds?

(As a workaround, I can pass this tuple as *args, but for other cases this wouldn’t work)

P.S. would be cool if this forum supported more topic categories, like “autograd” etc

there isn’t a good way right now (as you know) for a Variable to hold non-Tensors. We are planning scalars, but that’s about it.

I’ve added an autograd topic.

Sure about variables holding only tensors.

I was thinking more about allowing functions to accept arguments if they implement iter returning Variables. That would allow hacking up lists of variables, dicts with variables (or even custom objects holding variables) and passing them to autograd functions.