Skip to content

Commit 66233af

Browse files
authored
Use math.prod instead of np.prod for trivial ops (#14142)
1 parent bf13d40 commit 66233af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vllm/worker/cache_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SPDX-License-Identifier: Apache-2.0
22
"""CacheEngine class for managing the KV cache."""
3+
from math import prod
34
from typing import List
45

5-
import numpy as np
66
import torch
77

88
from vllm import envs
@@ -90,7 +90,7 @@ def _allocate_kv_cache(
9090
# NOTE this assumption currently only holds for MLA so we only apply
9191
# this optimization when `use_mla` is true
9292
entry_shape = kv_cache_shape[2:]
93-
entry_size = np.prod(entry_shape)
93+
entry_size = prod(entry_shape)
9494
alloc_entry_size = align_to_256bytes(entry_size, self.dtype)
9595
alloc_shape = (*kv_cache_shape[:2], alloc_entry_size)
9696
else:

0 commit comments

Comments
 (0)