Skip to content

[Feature]: Use math.prod instead of np.prod for trivial ops #14144

Closed
@zhanwenchen

Description

@zhanwenchen

🚀 The feature, motivation and pitch

Currently, https://github.com/vllm-project/vllm/blob/main/vllm/worker/cache_engine.py#L93 imports numpy solely for the purpose of entry_size = np.prod(entry_shape), where entry_shape = kv_cache_shape[2:] is an iterable of trivial size. Using the native Python 3.8 math.prod (https://docs.python.org/3/library/math.html#math.prod) would make the both imports and compute overhead lighter.

Alternatives

No response

Additional context

No response

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions