set_printoptions

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

Set the printing options for Tensor.

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 beginning and ending of each dimension, default 3.

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

  • linewidth (int, optional) – Number of characters each line, default 80.

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=Place(cpu), stop_gradient=True,
[[0.2727, 0.5489, 0.8655, ..., 0.2916, 0.8525, 0.9000],
 [0.3806, 0.8996, 0.0928, ..., 0.9535, 0.8378, 0.6409],
 [0.1484, 0.4038, 0.8294, ..., 0.0148, 0.6520, 0.4250],
 ...,
 [0.3426, 0.1909, 0.7240, ..., 0.4218, 0.2676, 0.5679],
 [0.5561, 0.2081, 0.0676, ..., 0.9778, 0.3302, 0.9559],
 [0.2665, 0.8483, 0.5389, ..., 0.4956, 0.6862, 0.9178]])