feat(add method is_private_use1() in class Device) (#98123)
As the title
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98123
Approved by: https://github.com/bdhirsh
diff --git a/c10/core/Device.h b/c10/core/Device.h
index 799b097..c1f302e 100644
--- a/c10/core/Device.h
+++ b/c10/core/Device.h
@@ -146,6 +146,11 @@
return type_ == DeviceType::CPU;
}
+ /// Return true if the device is of PrivateUse1 type.
+ bool is_privateuse1() const noexcept {
+ return type_ == DeviceType::PrivateUse1;
+ }
+
/// Return true if the device supports arbitrary strides.
bool supports_as_strided() const noexcept {
return type_ != DeviceType::IPU && type_ != DeviceType::XLA &&