rex_xai._utils

Attributes

Strategy

Queue

SpatialSearch

Exceptions

ReXError

Common base class for all non-exit exceptions.

ReXTomlError

Common base class for all non-exit exceptions.

ReXPathError

Common base class for all non-exit exceptions.

ReXScriptError

Common base class for all non-exit exceptions.

ReXDataError

Common base class for all non-exit exceptions.

ReXMapError

Common base class for all non-exit exceptions.

Functions

powerset(r[, reverse])

clause_area(clause, areas)

xlogx(ps)

_xlogx(p)

add_boundaries(img, segs[, colour])

get_device(gpu)

get_map_locations(map[, reverse])

set_boolean_mask_value(tensor, mode, order, coords[, val])

ff(obj, fmt)

Like format(obj, fmt), but returns the string 'None' if obj is None.

version()

Module Contents

rex_xai._utils.Strategy
rex_xai._utils.Queue
rex_xai._utils.SpatialSearch
rex_xai._utils.powerset(r, reverse=True)
rex_xai._utils.clause_area(clause, areas)
Parameters:

areas (Dict)

Return type:

int

exception rex_xai._utils.ReXError

Bases: Exception

Common base class for all non-exit exceptions.

exception rex_xai._utils.ReXTomlError(message)

Bases: ReXError

Common base class for all non-exit exceptions.

message
__str__()

Return str(self).

Return type:

str

exception rex_xai._utils.ReXPathError(message)

Bases: ReXError

Common base class for all non-exit exceptions.

message
__str__()

Return str(self).

Return type:

str

exception rex_xai._utils.ReXScriptError(message)

Bases: ReXError

Common base class for all non-exit exceptions.

message
__str__()

Return str(self).

Return type:

str

exception rex_xai._utils.ReXDataError(message)

Bases: ReXError

Common base class for all non-exit exceptions.

message
__str__()

Return str(self).

Return type:

str

exception rex_xai._utils.ReXMapError(message)

Bases: ReXError

Common base class for all non-exit exceptions.

message
__str__()

Return str(self).

Return type:

str

rex_xai._utils.xlogx(ps)
rex_xai._utils._xlogx(p)
rex_xai._utils.add_boundaries(img, segs, colour=None)
Parameters:
  • img (Union[numpy.typing.NDArray, torch.Tensor])

  • segs (numpy.typing.NDArray)

Return type:

numpy.typing.NDArray

rex_xai._utils.get_device(gpu)
Parameters:

gpu (bool)

rex_xai._utils.get_map_locations(map, reverse=True)
rex_xai._utils.set_boolean_mask_value(tensor, mode, order, coords, val=True)
Parameters:
  • coords (Union[rex_xai.box.Box, Tuple[numpy.typing.NDArray, numpy.typing.NDArray]])

  • val (bool)

rex_xai._utils.ff(obj, fmt)

Like format(obj, fmt), but returns the string ‘None’ if obj is None. See the help for format() to see acceptable values for fmt.

rex_xai._utils.version()