concatenate_functions¶
- qugradlab.pulses.composition.concatenate_functions(functions: list[Callable]) Callable[source]¶
Generates a function that executes the listed functions and concatenates the outputs.
- Parameters:
functions (list[Callable]) – A list of Callables that return concatenatable outputs.
- Returns:
A function that executes the listed functions and concatenates the outputs.
- Return type:
Callable
Example
>>> def f1(x): ... return [x + 1] >>> def f2(x): ... return [x - 1] >>> a = f1(1) >>> b = f2(2) >>> c = tf.concat([a, b], axis=-1) >>> f3 = concatenate_functions([f1, f2]) >>> d = f3([[1], [2]]) >>> assert all(c == d)