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

Function activation

tensorrt_llm/functional.py:767–788  ·  view source on GitHub ↗

Add an activation function. Parameters: input : Tensor The input tensor on which the activation function is applied. act_type : trt.ActivationType The type of the activation (RELU, TANH, SIGMOID, ...). The following closures are defined in func

(input: Tensor, act_type: trt.ActivationType)

Source from the content-addressed store, hash-verified

765
766
767def activation(input: Tensor, act_type: trt.ActivationType) -> Tensor:
768 '''
769 Add an activation function.
770
771 Parameters:
772 input : Tensor
773 The input tensor on which the activation function is applied.
774
775 act_type : trt.ActivationType
776 The type of the activation (RELU, TANH, SIGMOID, ...).
777
778 The following closures are defined in functional.*:
779
780 relu for op=trt.ActivationType.RELU
781 tanh for op=trt.ActivationType.TANH
782 sigmoid for op=trt.ActivationType.SIGMOID
783
784 Returns:
785 The tensor produced by the activation layer.
786 '''
787 layer = default_trtnet().add_activation(input.trt_tensor, act_type)
788 return _create_tensor(layer.get_output(0), layer)
789
790
791def int_clip(input: Tensor, lower: int, upper: int) -> Tensor:

Callers

nothing calls this directly

Calls 3

default_trtnetFunction · 0.85
_create_tensorFunction · 0.85
get_outputMethod · 0.45

Tested by

no test coverage detected