MCPcopy
hub / github.com/NVIDIA/TensorRT-LLM / max

Function max

tensorrt_llm/functional.py:3228–3250  ·  view source on GitHub ↗

Add an operation to compute the max along a dimension. Computes the max along the dimension 'dim' of the input tensor. It is implemented using the IReduceLayer from TensorRT. Parameters: input : Tensor The input tensor. dim : int The dimen

(input: Tensor, dim: int, keepdim: bool = False)

Source from the content-addressed store, hash-verified

3226
3227
3228def max(input: Tensor, dim: int, keepdim: bool = False) -> Tensor:
3229 '''
3230 Add an operation to compute the max along a dimension.
3231
3232 Computes the max along the dimension 'dim' of the input tensor.
3233
3234 It is implemented using the IReduceLayer from TensorRT.
3235
3236 Parameters:
3237 input : Tensor
3238 The input tensor.
3239
3240 dim : int
3241 The dimension along which the mean is computed.
3242
3243 keepdim : bool
3244 Is the dimension kept in the reduced tensor? When True the
3245 dimension is kept, it is removed from the shape otherwise.
3246
3247 Returns:
3248 The tensor produced by this reduction operation.
3249 '''
3250 return reduce(input, op=trt.ReduceOperation.MAX, dim=dim, keepdim=keepdim)
3251
3252
3253def sum(input: Tensor, dim: int, keepdim: bool = False) -> Tensor:

Callers 15

_get_draft_token_arrayFunction · 0.90
maintain_logitsFunction · 0.90
matmul_ogsFunction · 0.85
forwardMethod · 0.85
topk_forwardFunction · 0.85
n_blocksMethod · 0.85
sum_bitmatrix_rowsFunction · 0.85
compute_block_nFunction · 0.85
compute_block_kFunction · 0.85

Calls 1

reduceFunction · 0.85

Tested by 15

pad_tensorsFunction · 0.68
test_unittests_v2Function · 0.68
collect_statusFunction · 0.68
_check_mem_usageFunction · 0.68
test_connector_simpleFunction · 0.68
stress_testFunction · 0.68
get_perf_resultMethod · 0.68