flopscope.

flopscope.numpy.printoptions

flopscope.numpy.printoptions(*args, **kwargs)[flopscope source]

Context manager for setting print options.

Set print options for the scope of the with block, and restore the old options at the end. See set_printoptions for the full description of available options.

See also

Examples

>>> import flopscope.numpy as fnp
>>> from flops.testing import assert_equal
>>> with flops.printoptions(precision=2):
... flops.array([2.0]) / 3
array([0.67])

The as-clause of the with-statement gives the current print options:

>>> with flops.printoptions(precision=2) as opts:
... assert_equal(opts, flops.get_printoptions())