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)
| 3226 | |
| 3227 | |
| 3228 | def 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 | |
| 3253 | def sum(input: Tensor, dim: int, keepdim: bool = False) -> Tensor: |