def recursively_convert_elements(element, check_type, conversion_fn):

def convert_to_numpy_identity(*args, **kwargs):

Utilities

recursively_convert_elements

recursively_convert_elements(element, check_type, conversion_fn)[source]

Function to recursively convert all elements

Parameters
  • element (Any) – the element to convert

  • check_type (Any) – if element is of type check_type, the conversion function will be applied to it

  • conversion_fn (Any) – the function to apply to element if it is of type check_type

Returns

the converted element

Return type

Any

convert_to_numpy_identity

convert_to_numpy_identity(*args, **kwargs)[source]

Corrects the shape of all zero-sized numpy arrays to be at least 1d

Parameters
  • *args – positional arguments of potential arrays to be corrected

  • **kwargs – keyword arguments of potential arrays to be corrected