Aggregates caches for different components of TabICL:
ColEmbedding cache (for ISAB blocks in column embedding)
ICLearning cache (for Encoder layers in the ICL transformer)
Format
An R6::R6Class object.
Details
The train_shape field stores (batch_size, train_size, num_features)
as a 3-element integer vector.
Public fields
col_cacheOptional
KVCachefor ColEmbedding ISAB blocks.row_reprOptional
torch_tensor. Cached row representations.icl_cacheOptional
KVCachefor ICLearning Encoder layers.train_shapeInteger vector of length 3:
(batch_size, train_size, num_features).num_classesOptional integer. Number of classes in classification tasks (0 for regression). Stored when caching to ensure consistent output shape during cache use.
Methods
TabICLCache$new()
Create a new TabICLCache.
Initializes sub-caches automatically if not provided.
Usage
TabICLCache$new(
col_cache = NULL,
row_repr = NULL,
icl_cache = NULL,
train_shape = c(0, 0, 0),
num_classes = NULL
)TabICLCache$slice_batch()
Slice this cache along the batch dimension (dim 1 in R).
TabICLCache$to()
Move all cached tensors to the given device and optionally cast dtype.
Examples
if (FALSE) { # \dontrun{
cache <- TabICLCache$new(
train_shape = c(4, 100, 20),
num_classes = 10
)
cache$cache_type()
} # }