drytorch.utils.apply_ops
Module containing functions for nested containers.
Functions
|
Extend recursive_apply supports. |
|
Detach and store in cpu the tensors inside a container. |
|
Change the device of tensors inside a container. |
|
Look for an expected type and apply a given function. |
- apply(obj: _C, expected_type: type[_T], func: Callable[[_T], _T]) _C[source]
Extend recursive_apply supports.
If the input has attributes, it calls recursive_apply, creates a new instance and sets the attributes of a new instance to the new values.
- Parameters:
- Returns:
The container or class with the modified objects.
- Return type:
_C