graphdot.codegen.typetool module¶
-
class
graphdot.codegen.typetool.
common_concrete_type
[source]¶ Bases:
object
-
class
graphdot.codegen.typetool.
common_min_type
[source]¶ Bases:
object
-
static
of_types
(types, coerce=True, min_float=<class 'numpy.float32'>, ensure_signed=True)[source]¶ Find the common minimum elemet type that can safely hold all types in the given list.
Parameters: - iterable – Sequence of types for which a common type is to be inferred.
- coerce (bool) – Whether or not to up-cast in case when elements have different but inter-converible types.
- min_float (dtype) – The smallest floating-point type that should be returned. Introduced because float16 is not universally supported yet.
- ensure_signed (bool) – Whehter to promote the result to a signed type.
Returns: t – If coerce=True, t would be the smallest numpy type that can safely contain all the values; otherwise, t would either be the smallest numpy dtype or the Python class that the elements belongs to.
Return type: np.dtype or class
-
static
of_values
(iterable, coerce=True, min_float=<class 'numpy.float32'>, ensure_signed=True)[source]¶ Find the common minimum elemet type that can safely hold all elements of an iterable sequence.
Parameters: - iterable – Sequence of objects for which a common type is to be inferred.
- coerce (bool) – Whether or not to up-cast in case when elements have different but inter-converible types.
- min_float (dtype) – The smallest floating-point type that should be returned. Introduced because float16 is not universally supported yet.
- ensure_signed (bool) – Whehter to promote the result to a signed type.
Returns: t – If coerce=True, t would be the smallest numpy type that can safely contain all the values; otherwise, t would either be the smallest numpy dtype or the Python class that the elements belongs to.
Return type: np.dtype or class
-
static