plaid.utils.base¶
plaid.utils.base
¶
Base utilities.
plaid.utils.base.NotAllowedError
¶
Exception for not allowed usage.
plaid.utils.base.ShapeError
¶
Exception for badly shaped tensors.
plaid.utils.base.DeprecatedError
¶
Exception for deprecated methods.
plaid.utils.base.generate_random_ASCII
¶
Generate a random ASCII string of the specified size.
Parameters:
-
size(int, default:16) –The length of the generated string. Defaults to 16.
Returns:
-
str(str) –A random ASCII string of the specified size.
Source code in plaid/utils/base.py
plaid.utils.base.safe_len
¶
Safely return the length of an object, or 0 if the object has no length.
Parameters¶
obj : Any The object whose length is to be computed.
Returns:¶
int
The length of the object if it defines __len__, otherwise 0.