internal change

PiperOrigin-RevId: 842749037
This commit is contained in:
Martin Stolle 2025-12-10 09:00:41 -08:00 committed by Copybara-Service
parent 64178ace38
commit 2441ff01bf
1 changed files with 5 additions and 3 deletions

View File

@ -33,9 +33,7 @@ using KV_t = float;
// A non-owning view of a KVCache.
struct KVCachePtr {
bool IsEmpty() const { return kv_cache.Rows() == 0; }
size_t SeqLen() const {
return kv_cache.Rows();
}
size_t SeqLen() const;
MatPtrT<KV_t> kv_cache;
};
@ -66,6 +64,10 @@ struct KVCache {
KVCache(const Extents2D& kv_extents, const Allocator& allocator);
};
inline size_t KVCachePtr::SeqLen() const {
return kv_cache.Rows();
}
// Convenience function to create views into KVCaches.
std::vector<KVCachePtr> ToKVCachePtrs(const hwy::Span<KVCache>& kv_caches);