File tree Expand file tree Collapse file tree 3 files changed +841
-99
lines changed
Expand file tree Collapse file tree 3 files changed +841
-99
lines changed Original file line number Diff line number Diff line change @@ -4771,6 +4771,11 @@ def is_cuda(self):
47714771 def is_cpu(self):
47724772 return self.device is not None and self.device.type == "cpu"
47734773
4774+ @property
4775+ def is_meta(self):
4776+ dtype = self.dtype
4777+ return dtype is not None and self.dtype == torch.meta
4778+
47744779 # Serialization functionality
47754780 def state_dict(
47764781 self,
Original file line number Diff line number Diff line change @@ -80,8 +80,6 @@ class TensorClass:
8080 lock : bool = False ,
8181 ** kwargs ,
8282 ) -> None : ...
83- @property
84- def is_meta (self ) -> bool : ...
8583 def __bool__ (self ) -> bool : ...
8684 def __ne__ (self , other : object ) -> T : ...
8785 def __xor__ (self , other : TensorDictBase | float ): ...
@@ -459,9 +457,11 @@ class TensorClass:
459457 def cpu (self , ** kwargs ) -> T : ...
460458 def cuda (self , device : int | None = None , ** kwargs ) -> T : ...
461459 @property
462- def is_cuda (self ): ...
460+ def is_cuda (self ) -> bool : ...
463461 @property
464- def is_cpu (self ): ...
462+ def is_cpu (self ) -> bool : ...
463+ @property
464+ def is_meta (self ) -> bool : ...
465465 def state_dict (
466466 self ,
467467 destination : Incomplete | None = None ,
You can’t perform that action at this time.
0 commit comments