File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -555,6 +555,20 @@ def _is_cuda_torch(x: torch.Tensor) -> bool:
555555tensor_properties .append (is_cuda_opinfo )
556556
557557
558+ def _is_cpu_torch (x : torch .Tensor ) -> bool :
559+ return x .is_cpu
560+
561+
562+ is_cpu_opinfo = OpInfo (
563+ ltorch .is_cpu ,
564+ sample_input_generator = elementwise_unary_generator ,
565+ torch_reference = _is_cpu_torch ,
566+ dtypes = (datatypes .all_dtypes ),
567+ )
568+
569+ tensor_properties .append (is_cpu_opinfo )
570+
571+
558572def _is_nested_torch (x : torch .Tensor ) -> bool :
559573 return x .is_nested
560574
Original file line number Diff line number Diff line change @@ -333,6 +333,14 @@ def is_cuda(a: TensorLike, /) -> bool:
333333 return a .device .devicetype is devices .DeviceType .CUDA
334334
335335
336+ @torchsymbol (torch .Tensor .is_cpu , is_property = True , id = "torch.Tensor.is_cpu" )
337+ def is_cpu (a : TensorLike , / ) -> bool :
338+ return a .device .devicetype is devices .DeviceType .CPU
339+
340+
341+ register_method ("is_cpu" , is_cpu )
342+
343+
336344@torchsymbol (torch .polar , id = "torch.polar" )
337345def polar (abs_ : TensorLike , angle : TensorLike ):
338346 # Decompose polar into real/imag using Thunder ops and construct complex via mapped torch.complex
You can’t perform that action at this time.
0 commit comments