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

Function repeat

tensorrt_llm/functional.py:6292–6311  ·  view source on GitHub ↗

Repeats the tensor along the specified dimensions. Parameters: input : Tensor The tensor to be repeated. sizes : Sequence[int] The number of times to repeat the tensor along each dimension. Returns: A tensor except for repeated input ten

(input: Tensor, sizes: Sequence[int])

Source from the content-addressed store, hash-verified

6290
6291
6292def repeat(input: Tensor, sizes: Sequence[int]) -> Tensor:
6293 '''
6294 Repeats the tensor along the specified dimensions.
6295
6296 Parameters:
6297 input : Tensor
6298 The tensor to be repeated.
6299 sizes : Sequence[int]
6300 The number of times to repeat the tensor along each dimension.
6301
6302 Returns:
6303 A tensor except for repeated input tensors along specified dim.
6304
6305 '''
6306 assert input.ndim() <= len(sizes), \
6307 "Number of dimensions of repeat dims can not be smaller than number of dimensions of tensor"
6308 repeated_tensor = input
6309 for k in range(-1, -len(sizes) - 1, -1):
6310 repeated_tensor = concat([repeated_tensor] * sizes[k], dim=k)
6311 return repeated_tensor
6312
6313
6314def repeat_interleave(tensor: Tensor, repeats: int, dim: int) -> Tensor:

Callers 15

chunk_state_refFunction · 0.85
chunk_scan_refFunction · 0.85
__init__Method · 0.85
stepMethod · 0.85
parseFunction · 0.85
repeatMethod · 0.85
meshgrid2dFunction · 0.85
forwardMethod · 0.85

Calls 2

concatFunction · 0.85
ndimMethod · 0.45