utils
superduper.ext.torch.utils
device_of
​
device_of(module: 'Module') -> 't.Union[_device,
str]'
Parameter | Description |
---|---|
module | PyTorch model |
Get device of a model.
eval
​
eval(module: 'Module') -> 't.Iterator[None]'
Parameter | Description |
---|---|
module | PyTorch module |
Temporarily set a module to evaluation mode.
to_device
​
to_device(item: 't.Any',
device: 't.Union[str,
_device]') -> 't.Any'
Parameter | Description |
---|---|
item | torch.Tensor instance |
device | device to which one would like to send |
Send tensor leaves of nested list/ dictionaries/ tensors to device.
set_device
​
set_device(module: 'Module',
device: '_device')
Parameter | Description |
---|---|
module | PyTorch module |
device | Device to set |
Temporarily set a device of a module.