I’m sorry but I don’t know what passing a message along a dimension is. I’d recommend you to look for out-of-place functions that can do this, but I can’t recommend any, as I don’t know what are you trying to achieve.
Leaf Variables are Variables that are not results of any computation, so:
x = Variable(torch.randn(5, 5)) # this is a leaf
y = x + 2 # y is not a leaf