Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions gemma/weights.cc
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ static void ReadAllToBF16(const std::vector<TensorToRead>& tensors,
GCPP_ZONE(ctx, thread, Zones::kStartupWeightsReadAllToBF16);
const TensorToRead& tensor = tensors[task];
MatPtr& mat = *tensor.mat;
// Validate blob size matches allocated buffer before any read.
// MapAll (line ~557) and MakeBatches (line ~645) both assert this;
// this path was the only one missing the check.
HWY_ASSERT_M(tensor.range.bytes == mat.PackedBytes(), mat.Name());

if (tensor.keep_type) {
HWY_ASSERT(reader.file().Read(
Expand Down