vllm.v1.sample.ops.logprobs
Some utilities for logprobs, including logits.
batched_count_greater_than ¶
Counts elements in each row of x that are greater than the corresponding value in values. Use torch.compile to generate an optimized kernel for this function. otherwise, it will create additional copies of the input tensors and cause memory issues.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x | Tensor | A 2D tensor of shape (batch_size, n_elements). | required |
values | Tensor | A 2D tensor of shape (batch_size, 1). | required |
Returns:
Type | Description |
---|---|
Tensor | torch.Tensor: A 1D tensor of shape (batch_size,) with the counts. |