scimba_torch.utils.typing_protocols¶
Common typing protocols to replace mypy_extensions usage.
This module provides type-safe alternatives to mypy_extensions constructs using the standard library’s typing.Protocol.
Classes
alias of |
|
|
Protocol for higher-order functions. |
|
Protocol for functions taking a tensor x and keyword arguments. |
alias of |
|
alias of |
|
|
Protocol for callable with variable arguments of any type. |
|
Protocol for callable with variable torch.Tensor arguments. |
- class VarArgCallable(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for callable with variable torch.Tensor arguments.
Replaces: Callable[[VarArg(torch.Tensor)], torch.Tensor]
- class VarArgAnyCallable(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for callable with variable arguments of any type.
Replaces: Callable[[VarArg(Any)], torch.Tensor]
- class FuncTypeCallable(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for functions taking a tensor x and keyword arguments.
Replaces: Callable[[Arg(torch.Tensor, “x”), KwArg(Any)], torch.Tensor]
- class FuncFuncArgsCallable(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for higher-order functions.
This function takes another function and additional args.
Replaces: Callable[[TYPE_FUNC_ARGS, VarArg(TYPE_ARGS)], torch.Tensor]
- FUNC_TYPE¶
alias of
FuncTypeCallable
- TYPE_FUNC_ARGS¶
alias of
VarArgCallable
- TYPE_FUNC_FUNC_ARGS¶
alias of
FuncFuncArgsCallable