Skip to content

Commit 5b0425f

Browse files
committed
Add .numpy() to LazyTensor
1 parent 3d47294 commit 5b0425f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gpytorch/lazy/lazy_tensor.py

+6
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,12 @@ def numel(self):
11431143
"""
11441144
return self.shape.numel()
11451145

1146+
def numpy(self):
1147+
"""
1148+
Return self as an evaluated numpy array
1149+
"""
1150+
return self.evaluate().detach().cpu().numpy()
1151+
11461152
def permute(self, *dims):
11471153
num_dims = self.dim()
11481154
orig_dims = dims

0 commit comments

Comments
 (0)