Class TFCDictRobust#

Inheritance Relationships#

Base Type#

  • public OrderedDict

Class Documentation#

tfc.utils.TFCUtils.TFCDictRobust : public OrderedDict
This class is like the :class:`TFCDict <tfc.utils.TFCUtils.TFCDict>` class, but it handles non-flat arrays.

Public Functions

__init__(self, *Any args)#
Initialize TFCDictRobust using the OrderedDict method.

Parameters
----------
*args : Any
    Arguments to pass to the OrderedDict
getSlices(self)#
Function that creates slices for each of the keys in the dictionary.
update(self, *Any args)#
Overload the update method to update the _keys variable as well.

Parameters
----------
*args : Any
    Same as *args for the update method on ordered dict.
toArray(self)#
Send dictionary to a flat JAX array.

Returns
-------
np.ndarray
    This dictionary as a flat JAX array.
toDict(self, np.ndarray arr)#
Send a flat JAX array to a TFCDictRobust with the same keys.

Parameters
----------
arr : np.ndarray
    Flat JAX array to convert to TFCDictRobust. Must have the same number of elements as total number of elements in the dictionary.

Returns
-------
TFCDictRobust
    JAX array as a TFCDictRobust
block_until_ready(self)#
Mimics block_until_ready for jax arrays. Used to halt the program until the computation that created the
dictionary is finished.

Returns
-------
TFCDictRobust
    This TFCDictRobust
__iadd__(self, TFCDictRobustAddable o)#
Used to overload "+=" for TFCDictRobust so that 2 TFCDictRobust's can be added together.

Parameters
----------
o : TFCDictRobustAddable
    Values to add to the current dicitonary.

Returns
----------
self : TFCDictRobust
    A copy of self after adding in the values from o.
__isub__(self, TFCDictRobustAddable o)#
Used to overload "-=" for TFCDictRobust so that 2 TFCDictRobust's can be subtracted.

Parameters
----------
o : TFCDictRobustAddable
    Values to subtract from the current dicitonary.

Returns
----------
self : TFCDictRobust
    A copy of self after subtracting the values from o.
__add__(self, TFCDictRobustAddable o)#
Used to overload "+" for TFCDictRobust so that 2 TFCDictRobust's can be added together.

Parameters
----------
o : TFCDictRobustAddable
    Values to add to the current dicitonary.

Returns
----------
out : TFCDictRobust
    A TFCDictRobust with values = self + o.
__sub__(self, TFCDictRobustAddable o)#
Used to overload "-" for TFCDictRobust so that 2 TFCDictRobust's can be subtracted.

Parameters
----------
o : TFCDictRobustAddable
    Values to subtract from the current dicitonary.

Returns
-------
self : TFCDictRobust
    A TFCDictRobust with values = self - o.

Protected Attributes

_keys#
_nKeys#
_slices#