pangolin.interface.overload

Contents

pangolin.interface.overload#

pangolin.interface.overload(*, broadcasting=None)#

Temporarily change the default interface’s configuration. Unspecified options retain their current values. Overrides may be nested, and the previous configuration is restored on exit, including when an exception occurs.

Parameters:

broadcasting – One of "off", "simple", "rank", or "numpy"; None leaves the current mode unchanged.

Raises:
  • TypeError – If an unknown option is supplied or the value is not a string or None.

  • ValueError – If the mode is unsupported.

>>> from pangolin import interface as pi
>>> with pi.overload(broadcasting="rank"):
...     x = pi.normal([0, 1], [[1, 1], [2, 2]])
...     x.shape
(2, 2)