set_printoptions

paddle. set_printoptions ( precision=None, threshold=None, edgeitems=None, sci_mode=None ) [source]

Set the printing options for Tensor. NOTE: The function is similar with numpy.set_printoptions()

Parameters
  • precision (int, optional) – Number of digits of the floating number, default 8.

  • threshold (int, optional) – Total number of elements printed, default 1000.

  • edgeitems (int, optional) – Number of elements in summary at the begining and end of each dimension, defalt 3.

  • sci_mode (bool, optional) – Format the floating number with scientific notation or not, default False.

Returns

None.

Examples

import paddle

paddle.seed(10)
a = paddle.rand([10, 20])
paddle.set_printoptions(4, 100, 3)
print(a)

'''
Tensor(shape=[10, 20], dtype=float32, place=CUDAPlace(0), stop_gradient=True,
       [[0.0002, 0.8503, 0.0135, ..., 0.9508, 0.2621, 0.6661],
        [0.9710, 0.2605, 0.9950, ..., 0.4427, 0.9241, 0.9363],
        [0.0948, 0.3226, 0.9955, ..., 0.1198, 0.0889, 0.9231],
        ...,
        [0.7206, 0.0941, 0.5292, ..., 0.4856, 0.1379, 0.0351],
        [0.1745, 0.5621, 0.3602, ..., 0.2998, 0.4011, 0.1764],
        [0.0728, 0.7786, 0.0314, ..., 0.2583, 0.1654, 0.0637]])
'''