@Namespace(value="torch::data::samplers") @NoOffset @Properties(inherit=torch.class) public class RandomSampler extends Sampler
Sampler
that returns random indices.Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
RandomSampler(long size) |
RandomSampler(long size,
torch.ScalarType index_dtype)
Constructs a
RandomSampler with a size and dtype for the stored indices. |
RandomSampler(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
index()
Returns the current index of the
RandomSampler . |
void |
load(InputArchive archive)
Deserializes the
RandomSampler from the archive . |
SizeTVectorOptional |
next(long batch_size)
Returns the next batch of indices.
|
void |
reset() |
void |
reset(SizeTOptional new_size)
Resets the
RandomSampler to a new set of indices. |
void |
save(OutputArchive archive)
Serializes the
RandomSampler to the archive . |
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 RandomSampler(Pointer p)
Pointer(Pointer)
.public RandomSampler(@Cast(value="int64_t") long size, torch.ScalarType index_dtype)
RandomSampler
with a size and dtype for the stored indices.
The constructor will eagerly allocate all required indices, which is the
sequence 0 ... size - 1
. index_dtype
is the data type of the stored
indices. You can change it to influence memory usage.public void reset(@ByVal(nullValue="c10::optional<size_t>(c10::nullopt)") SizeTOptional new_size)
RandomSampler
to a new set of indices.public void reset()
@ByVal public SizeTVectorOptional next(@Cast(value="size_t") long batch_size)
public void save(@ByRef OutputArchive archive)
RandomSampler
to the archive
.public void load(@ByRef InputArchive archive)
RandomSampler
from the archive
.@Cast(value="size_t") @NoException(value=true) public long index()
RandomSampler
.Copyright © 2024. All rights reserved.