ytm.tm.backends.buffers.TMFitBuffers#

class ytm.tm.backends.buffers.TMFitBuffers#

Bases: FitBuffers

Fit buffers of the TM. Adds to FitBuffers:

Attributes:
feedback_typearray of shape (n_clauses, n_classes), uint8

Feedback of each clause per class on the current sample, one of FB_NONE, FB_T1A, FB_T1B, FB_T2.

probarray of shape (n_classes,)

Signed update probability of each class for the current sample.

label_probsarray of shape (chunk, n_classes)

Chance that each class gives feedback at all, per sample. A per-sample field.

end_epoch() → None#

Drop the epoch’s inputs and reset the chunk range.

load_chunk(start: int, end: int) → None#

Move samples [start, end) of every per-sample field to the device.

start_epoch(**fields: Any) → None#

Take the epoch’s inputs as keyword arguments, X included.

Per-sample fields are kept on the host until load_chunk. The others are set now, numpy arrays moved to the device.