@Namespace(value="torch::data::samplers") @NoOffset @Properties(inherit=torch.class) public class StreamSampler extends BatchSizeSampler
StreamSampler
is that it does not return
particular indices, but instead only the number of elements to fetch from
the dataset. The dataset has to decide how to produce those elements.Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
StreamSampler(long epoch_size)
Constructs the
StreamSampler with the number of individual examples that
should be fetched until the sampler is exhausted. |
StreamSampler(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
load(InputArchive archive)
Deserializes the
StreamSampler from the archive . |
BatchSizeOptional |
next(long batch_size)
Returns a
BatchSize object with the number of elements to fetch in the
next batch. |
void |
reset() |
void |
reset(SizeTOptional new_size)
Resets the internal state of the sampler.
|
void |
save(OutputArchive archive)
Serializes the
StreamSampler 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 StreamSampler(Pointer p)
Pointer(Pointer)
.public void reset(@ByVal(nullValue="c10::optional<size_t>(c10::nullopt)") SizeTOptional new_size)
reset
in class BatchSizeSampler
public void reset()
@ByVal public BatchSizeOptional next(@Cast(value="size_t") long batch_size)
BatchSize
object with the number of elements to fetch in the
next batch. This number is the minimum of the supplied batch_size
and
the difference between the epoch_size
and the current index. If the
epoch_size
has been reached, returns an empty optional.next
in class BatchSizeSampler
public void save(@ByRef OutputArchive archive)
StreamSampler
to the archive
.save
in class BatchSizeSampler
public void load(@ByRef InputArchive archive)
StreamSampler
from the archive
.load
in class BatchSizeSampler
Copyright © 2024. All rights reserved.