exarl.network.typing
Module Contents
Classes
This class is a group of commonly used functions that help to figure out what type a data object is |
Attributes
- exarl.network.typing.MPI
- class exarl.network.typing.TypeUtils
This class is a group of commonly used functions that help to figure out what type a data object is as well as providing type conversions between numpy, mpi, and python types.
- list_like(data)
Updates tracing metrics for the given name.
- Parameters
data (any) – list to check
- Returns
bool, type – returns if data is range, tuple, np.array, or a list and the type
- get_flat_size(data)
Gives the number of elements of a hierarchical list.
- Parameters
data (any) – list to check
- Returns
int – Number of total elements in hierarchical list
- get_shape(data)
Takes some data and returns its shape.
- Parameters
data (any) – list to check
- Returns
list – shape of a hierarchical list
- get_type(data, cast=None)
Returns a list of types for each element in list.
- Parameters
data (any) – list to check
cast (type, optional) – If passed will cast data to this type
- Returns
list – List of all the types.
- get_dumps(data)
This is to help diagnose error in MPI pickle dumps. Provides a list of the dump of each element and returns in the same list structure.
- Parameters
data (any) – data to evaluate
- Returns
list – hierarchical list of dumps
- check_diff(data1, data2)
Performs a per element comparison of elements in a hierarchical list. Checks both the type and content.
- Parameters
data1 (any) – data to compare
data2 (any) – data to compare
- Returns
bool – returns True if they are different and False if they are the same.
- compare(data1, data2)
Returns if the flat size, shape, and pickle dumps are the same
- Parameters
data1 (any) – data to be compared
data2 (any) – data to be compared
- Returns
bool – True if there are the same
- np_type_converter(the_type, promote=True)
Provides the equivalent numpy type givin python, MPI, tensorflow type.
- Parameters
the_type (type) – type to be converted
promote (bool, optional) – promots from 32 to 64 bit precision
- Returns
type – return corresponding np type
- tf_type_converter(the_type, promote=True)
Provides the equivalent tensorflow type givin python, MPI, or numpy type.
- Parameters
the_type (type) – type to be converted
promote (bool, optional) – promots from 32 to 64 bit precision
- Returns
type – return corresponding tensorflow type
- mpi_type_converter(the_type, promote=True)
Provides the equivalent MPI type givin python, tensorflow, or numpy type.
- Parameters
the_type (type) – type to be converted
promote (bool, optional) – promots from 32 to 64 bit precision
- Returns
type – return corresponding mpi type
- promote_numpy_type(data, makeList=True)
Turns non-list-like data to a numpy array. Promotes numpy lists from 32 to 64 bit.
- Parameters
data (single value or np.array) – Data to promote
makeList (bool, optional) – Indicates if data should be converted to np.array if not already np.array
- Returns
np.array – return promoted data