@Namespace(value="c10") @NoOffset @Properties(inherit=torch.class) public class Device extends Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
Device(byte type) |
Device(byte type,
byte index) |
Device(BytePointer device_string)
Constructs a
Device from a string description, for convenience. |
Device(Pointer p)
Pointer cast constructor.
|
Device(String device_string) |
Device(torch.DeviceType type) |
Device(torch.DeviceType type,
byte index)
Constructs a new
Device from a DeviceType and an optional device
index. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Device other)
Returns true if the type and index of this
Device matches that of
other . |
boolean |
has_index()
Returns true if the device has a non-default index.
|
byte |
index()
Returns the optional index.
|
boolean |
is_cpu()
Return true if the device is of CPU type.
|
boolean |
is_cuda()
Return true if the device is of CUDA type.
|
boolean |
is_hip()
Return true if the device is of HIP type.
|
boolean |
is_hpu()
Return true if the device is of HPU type.
|
boolean |
is_ipu()
Return true if the device is of IPU type.
|
boolean |
is_lazy()
Return true if the device is of Lazy type.
|
boolean |
is_meta()
Return true if the device is of META type.
|
boolean |
is_metal()
Return true if the device is of Metal type.
|
boolean |
is_mps()
Return true if the device is of MPS type.
|
boolean |
is_mtia()
Return true if the device is of MTIA type.
|
boolean |
is_ort()
Return true if the device is of ORT type.
|
boolean |
is_privateuseone()
Return true if the device is of PrivateUse1 type.
|
boolean |
is_ve()
Return true if the device is of VE type.
|
boolean |
is_vulkan()
Return true if the device is of Vulkan type.
|
boolean |
is_xla()
Return true if the device is of XLA type.
|
boolean |
is_xpu()
Return true if the device is of XPU type.
|
boolean |
notEquals(Device other)
Returns true if the type or index of this
Device differs from that of
other . |
void |
set_index(byte index)
Sets the device index.
|
BytePointer |
str()
Same string as returned from operator<<.
|
boolean |
supports_as_strided()
Return true if the device supports arbitrary strides.
|
torch.DeviceType |
type()
Returns the type of device this is.
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public Device(Pointer p)
Pointer(Pointer)
.public Device(torch.DeviceType type, @Cast(value="c10::DeviceIndex") byte index)
Device
from a DeviceType
and an optional device
index.public Device(torch.DeviceType type)
public Device(@Cast(value="c10::DeviceType") byte type, @Cast(value="c10::DeviceIndex") byte index)
public Device(@StdString BytePointer device_string)
Device
from a string description, for convenience.
The string supplied must follow the following schema:
(cpu|cuda)[:<device-index>]
where cpu
or cuda
specifies the device type, and
:<device-index>
optionally specifies a device index.public Device(@StdString String device_string)
@Cast(value="bool") @Name(value="operator ==") @NoException(value=true) public boolean equals(@Const @ByRef Device other)
Device
matches that of
other
.@Cast(value="bool") @Name(value="operator !=") @NoException(value=true) public boolean notEquals(@Const @ByRef Device other)
Device
differs from that of
other
.@NoException(value=true) public torch.DeviceType type()
@Cast(value="c10::DeviceIndex") @NoException(value=true) public byte index()
@Cast(value="bool") @NoException(value=true) public boolean has_index()
@Cast(value="bool") @NoException(value=true) public boolean is_cuda()
@Cast(value="bool") @NoException(value=true) public boolean is_privateuseone()
@Cast(value="bool") @NoException(value=true) public boolean is_mps()
@Cast(value="bool") @NoException(value=true) public boolean is_hip()
@Cast(value="bool") @NoException(value=true) public boolean is_ve()
@Cast(value="bool") @NoException(value=true) public boolean is_xpu()
@Cast(value="bool") @NoException(value=true) public boolean is_ipu()
@Cast(value="bool") @NoException(value=true) public boolean is_xla()
@Cast(value="bool") @NoException(value=true) public boolean is_mtia()
@Cast(value="bool") @NoException(value=true) public boolean is_hpu()
@Cast(value="bool") @NoException(value=true) public boolean is_lazy()
@Cast(value="bool") @NoException(value=true) public boolean is_vulkan()
@Cast(value="bool") @NoException(value=true) public boolean is_metal()
@Cast(value="bool") @NoException(value=true) public boolean is_ort()
@Cast(value="bool") @NoException(value=true) public boolean is_meta()
@Cast(value="bool") @NoException(value=true) public boolean is_cpu()
@Cast(value="bool") @NoException(value=true) public boolean supports_as_strided()
@StdString public BytePointer str()
Copyright © 2024. All rights reserved.