trunc¶
- paddle. trunc ( input, name=None ) [source]
- 
         This API is used to returns a new tensor with the truncated integer values of input. - Parameters
- 
           - input (Tensor) – The input tensor, it’s data type should be int32, int64, float32, float64. 
- name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name. 
 
- Returns
- 
           The output Tensor of trunc. 
- Return type
- 
           Tensor 
 Examples import paddle input = paddle.rand([2,2],'float32') print(input) # Tensor(shape=[2, 2], dtype=float32, place=CUDAPlace(0), stop_gradient=True, # [[0.02331470, 0.42374918], # [0.79647720, 0.74970269]]) output = paddle.trunc(input) print(output) # Tensor(shape=[2, 2], dtype=float32, place=CUDAPlace(0), stop_gradient=True, # [[0., 0.], # [0., 0.]])) 
