Add a CLIP operation that sets the range to [alpha, beta]. Parameters: input : Tensor The input tensor on which the activation function is applied. alpha : float The lower bound of the CLIP function. beta : float The upper bound
(input: Tensor, alpha: float, beta: float)
| 796 | |
| 797 | |
| 798 | def clip(input: Tensor, alpha: float, beta: float) -> Tensor: |
| 799 | ''' |
| 800 | Add a CLIP operation that sets the range to [alpha, beta]. |
| 801 | |
| 802 | Parameters: |
| 803 | input : Tensor |
| 804 | The input tensor on which the activation function is applied. |
| 805 | |
| 806 | alpha : float |
| 807 | The lower bound of the CLIP function. |
| 808 | |
| 809 | beta : float |
| 810 | The upper bound of the CLIP function. |
| 811 | |
| 812 | Returns: |
| 813 | The tensor produced by the activation layer. |
| 814 | ''' |
| 815 | layer = default_trtnet().add_activation(input.trt_tensor, |
| 816 | trt.ActivationType.CLIP) |
| 817 | layer.alpha = alpha |
| 818 | layer.beta = beta |
| 819 | return _create_tensor(layer.get_output(0), layer) |
| 820 | |
| 821 | |
| 822 | relu = partial(activation, act_type=trt.ActivationType.RELU) |
no test coverage detected