paddle.sparse. rad2deg ( x, name=None ) [source]

Convert each of the elements of input x from angles in radians to degrees, requiring x to be a SparseCooTensor or SparseCsrTensor.

\[rad2deg(x) = 180/ \pi * x\]
  • x (Tensor) – The input Sparse Tensor with data type float32, float64, int32, int64.

  • name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.


A Sparse Tensor with the same data type and shape as x .


import paddle

dense_x = paddle.to_tensor([3.142, 0., -3.142])
sparse_x = dense_x.to_sparse_coo(1)
out = paddle.sparse.rad2deg(sparse_x)