Pysyft: Calling .size() on a PointerTensor always returns a size of 0

Created on 18 Aug 2019  路  2Comments  路  Source: OpenMined/PySyft

Describe the bug
Not sure if this was reported before. Couldn't find any issue about it. It seems like .size() method is not implemented for PointerTensors, making the Wrapper return torch.Size([0])

To Reproduce
Here's a script demonstrating the issue

import torch
import syft

hook = syft.TorchHook(torch)

alice = syft.VirtualWorker(id="alice", hook=hook)

x = torch.Tensor([[1,2,3]])
print(x.size()) #=> torch.Size([1, 3]) 

# send x to alice and call size
x = x.send(alice)
print(x.size()) #=> torch.Size([0])

Expected behavior
.size() should return the size of the tensor being pointed at.

Desktop (please complete the following information):

  • OS: MacOS Mojave
  • Version 0.1.23a1
Good first issue Type

Most helpful comment

Hey,
I would recommend using .shape instead of .size()
We have trouble with .size(), as explained here: https://github.com/OpenMined/PySyft/issues/2201

All 2 comments

Hey,
I would recommend using .shape instead of .size()
We have trouble with .size(), as explained here: https://github.com/OpenMined/PySyft/issues/2201

@LaRiffle not sure why I couldn't find that issue at the time of posting this. Since this is a duplicate, I'll close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wentaiwu92 picture wentaiwu92  路  4Comments

MetaT1an picture MetaT1an  路  3Comments

beatrizsmg picture beatrizsmg  路  4Comments

robert-wagner picture robert-wagner  路  4Comments

iamtrask picture iamtrask  路  4Comments