leaspy.utils.functional
Attributes
Classes
Bridge from a function with positional parameters to a function with keyword-only parameters. |
Functions
Get the names of parameters of the input function f, which should be |
Package Contents
- Exp
- Identity
- MatMul
- Mean
- OrthoBasis
- Prod
- Sqr
- Std
- Sum
- SumDim
- class NamedInputFunction
Bases:
Generic[RT]Bridge from a function with positional parameters to a function with keyword-only parameters.
- Parameters:
- fCallable
The original function. The named parameters to be sent in f should be: positional, positional-or-keyword, or variadic arguments. It can also have some keyword-only arguments, but they should be fixed once for all with attribute kws.
- parameterstuple[str, …]
Assigned names, in order, for positional parameters of f.
- kwsNone (default) or dictionary[str, Any]
Some optional fixed keyword parameters to pass upon function calls.
Notes
We do not implement the mapping of keyword-only to renamed keyword-only parameters for now since it is not needed and would make the logic more complex. Particularly due to the existence of positional-only parameters.
- f: Callable[Ellipsis, RT]
- call(named_params)
Call the underlying function with the correct positional arguments, retrieved by parameter names in input variables.
- Parameters:
named_params (Mapping[str, Any])
- Return type:
RT
- then(g, **g_kws)
Return a new NamedInputFunction applying (g o f) function.
- Parameters:
g (Callable[[RT], S])