Skip to content

Commit 7c0fd4c

Browse files
committed
Add a type method
1 parent 0a75a81 commit 7c0fd4c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

gpytorch/lazy/lazy_tensor.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,16 @@ def transpose(self, dim1, dim2):
19601960

19611961
return res
19621962

1963+
def type(self, dtype):
1964+
if dtype == torch.float:
1965+
return self.float()
1966+
elif dtype == torch.double:
1967+
return self.double()
1968+
elif dtype == torch.half:
1969+
return self.half()
1970+
else:
1971+
raise RuntimeError("Dtype", dtype, "not found.")
1972+
19631973
def unsqueeze(self, dim):
19641974
positive_dim = (self.dim() + dim + 1) if dim < 0 else dim
19651975
if positive_dim > len(self.batch_shape):

0 commit comments

Comments
 (0)