jax.numpy.printoptions#
- jax.numpy.printoptions(*args, **kwargs)[源代码]#
用于设置打印选项的上下文管理器。
为 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-statement 的 as-clause 提供了当前的打印选项:
>>> with np.printoptions(precision=2) as opts: ... assert_equal(opts, np.get_printoptions())