Allow creating empty `AttentionActivations` for experimental code.

PiperOrigin-RevId: 772077675
This commit is contained in:
Biruk Mammo 2025-06-16 10:18:35 -07:00 committed by Copybara-Service
parent 6773e4517c
commit 5f3797f6e1
1 changed files with 4 additions and 1 deletions

View File

@ -98,7 +98,10 @@ struct AttentionActivations {
div_seq_len(static_cast<uint32_t>(seq_len)), div_seq_len(static_cast<uint32_t>(seq_len)),
query_scale(ChooseQueryScale(config)) { query_scale(ChooseQueryScale(config)) {
HWY_ASSERT(batch_size != 0); if (batch_size == 0) {
HWY_WARN("Creating mostly empty activations with a batch_size of 0.");
return;
}
// For MatMul outputs, precompute their row pointers. // For MatMul outputs, precompute their row pointers.
// If we forget any MatMul outputs here, debug builds print a warning but // If we forget any MatMul outputs here, debug builds print a warning but