Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/test_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,10 @@ def test_randperm(self):
x = torch.randperm(3, device=xm.xla_device())
self.assertEqual(x.device.type, 'xla')

def test_no_storage(self):
x = torch.randn(5, device=xm.xla_device())
self.assertRaises(Exception, x.device)

def test_slice_copy(self):
a = torch.rand(3, 3, 3)
xla_device = xm.xla_device()
Expand Down
6 changes: 6 additions & 0 deletions torch_xla/csrc/tensor_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,10 @@ void XLATensorImpl::AtenInitialize() {
// ATEN specific initialization calls placed below.
}

const at::Storage& XLATensorImpl::storage() const {
XLA_ERROR() << "XLA tensors do not have storage";
}

bool XLATensorImpl::has_storage() const { return false; }

} // namespace torch_xla
4 changes: 4 additions & 0 deletions torch_xla/csrc/tensor_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class XLATensorImpl : public c10::TensorImpl {

static void AtenInitialize();

const at::Storage& storage() const override;

bool has_storage() const override;

private:
void SetupSizeProperties();

Expand Down