When iterable methods are called on remote objects, the get() method returns an empty tensor. See expected and current behavior for more info.
torch.stack and torch.cat are great examples of such methods.
torch.stack
torch.cat
>>> x = torch.FloatTensor([1,2,3,4]).send(remote)
>>> y = torch.FloatTensor([3,4,1,2]).send(remote)
>>> z = torch.FloatTensor([5,2,1,4]).send(remote)
>>> torch.stack([x,y,z]).get()
1 2 3 4
3 4 1 2
5 2 1 4
[torch.FloatTensor of size 3x4]
What is the current behavior?
>>> x = torch.FloatTensor([1,2,3,4]).send(remote)
>>> y = torch.FloatTensor([3,4,1,2]).send(remote)
>>> z = torch.FloatTensor([5,2,1,4]).send(remote)
>>> torch.stack([x,y,z]).get()
[torch.FloatTensor with no dimension]
When iterable methods are called on remote objects, the get() method returns an empty tensor.
Please provide detailed steps for reproducing the issue. (for bugs)
>>> x = torch.FloatTensor([1,2,3,4]).send(remote)
>>> y = torch.FloatTensor([3,4,1,2]).send(remote)
>>> z = torch.FloatTensor([5,2,1,4]).send(remote)
>>> torch.stack([x,y,z]).get()
For such methods, arrays are not supported as an argument and a tensor of tensors should be only used.
Hey @alhparsa, I'm reopening this. Maintaining the original semantics of PyTorch is very important, and I think this should be covered when #1395 lands. We'll close when that happens.
Yes, my PR fix this, I will add a unit test
doing this works for stack and cat
torch.stack([x.get(),y.get(),z.get()])
1 2 3
2 3 4
5 6 7
[torch.FloatTensor of size 3x3]
I added the unittests based on this.
This also works!
t = torch.FloatTensor([x,y,z])
torch.stack(t).get()
@bartimaeus12 your code actually doesn't apply the function remotely. What it does is that it gets the tensors and then it applies the function locally on them. What we want is something like torch.stack(some array of arrays or a tensor of tensors).get() this way the function is applied remotely first and then by calling the get() method we receive the data.
Most helpful comment
Yes, my PR fix this, I will add a unit test