jax.numpy.printoptions#
- jax.numpy.printoptions(*args, **kwargs)[source]#
用於設定列印選項的上下文管理器。
為 with 區塊的範圍設定列印選項,並在結束時還原舊選項。 有關可用選項的完整說明,請參閱 set_printoptions。
範例
>>> import numpy as np
>>> from numpy.testing import assert_equal >>> with np.printoptions(precision=2): ... np.array([2.0]) / 3 array([0.67])
with 語句的 as 子句提供目前的列印選項
>>> with np.printoptions(precision=2) as opts: ... assert_equal(opts, np.get_printoptions())