experanto.utils.SessionSpecificSampler
- class SessionSpecificSampler(*args, **kwargs)[source]
Bases:
SamplerA batch sampler specific to a single session that efficiently generates batches from the session’s indices.
Methods
__init__(indices, batch_size[, drop_last, ...])Initialize session-specific sampler.
Return the state of the sampler (including RNG state).
set_position(position)Set the current batch position.
set_state(state)Restore the state of the sampler (including RNG state).
- __init__(indices, batch_size, drop_last=False, shuffle=False, seed=None)[source]
Initialize session-specific sampler.
- Parameters:
indices (list) – Dataset indices belonging to this session.
batch_size (int) – Number of samples per batch.
drop_last (bool, optional) – Whether to drop the last batch if smaller than batch_size. Default is False.
shuffle (bool, optional) – Whether to shuffle indices. Default is False.
seed (int, optional) – Random seed for reproducibility.