Skip to content

Commit

Permalink
Implement the get_device method in the storage base class.
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeYan committed Apr 23, 2023
1 parent 7a8d0cc commit cf589af
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion torch/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ def size(self) -> int:
def type(self, dtype: str = None, non_blocking: bool = False) -> T: ... # noqa: E704
def cuda(self, device=None, non_blocking=False, **kwargs) -> T: ... # noqa: E704
def element_size(self) -> int: ... # noqa: E704
def get_device(self) -> int: ... # noqa: E704

def get_device(self) -> int:
return self.device.index

def data_ptr(self) -> int: ... # noqa: E704

# Defined in torch/csrc/generic/StorageSharing.cpp
Expand Down

0 comments on commit cf589af

Please sign in to comment.