lab.util module¶
-
lab.util.
abstract
(promote=- 1)[source]¶ Create a decorator for an abstract function.
- Parameters
promote (int, optional) – Number of arguments to promote. Set to -1 to promote all arguments, and set to None or 0 to promote no arguments. Defaults to -1.
- Returns
Decorator.
- Return type
function
-
lab.util.
as_tuple
[source]¶ Get x as a tuple. Will be wrapped in a one-tuple if it is not a tuple.
- Parameters
x (object) – Object to get as a tuple.
- Returns
x as a tuple.
- Return type
tuple
-
lab.util.
batch_computation
(f, xs, ranks)[source]¶ Apply a function over all batches of arguments.
- Parameters
f (function) – Function that performs the computation.
xs (tuple) – Matrices or batches of matrices.
ranks (tuple) – Ranks of the arguments.
- Returns
Result in batched form.
- Return type
tensor