model.utils.tensor¶
Tensor and tensor-mapping helpers for ADELM.
Module Contents¶
Functions¶
Detach all tensors in a |
|
Return a shallow copy of a |
|
Move all tensors in a |
|
Expand 0-dimensional (scalar) tensors in |
Data¶
API¶
- model.utils.tensor.detach_mapping(mapping)¶
Detach all tensors in a
dictfrom the computational graph.Non-tensor values are passed through unchanged.
- model.utils.tensor.clone_mapping(mapping)¶
Return a shallow copy of a
dictwith all tensors cloned.Non-tensor values are passed through unchanged.
- model.utils.tensor.move_mapping(mapping, device)¶
Move all tensors in a
dicttodevice.Non-tensor values are passed through unchanged.
- model.utils.tensor.broadcast_scalar_params(params, n_entities)¶
Expand 0-dimensional (scalar) tensors in
paramsto shape[n_entities].Tensors with one or more dimensions and non-tensor values are passed through unchanged.
- model.utils.tensor.__all__¶
[ābroadcast_scalar_paramsā, āclone_mappingā, ādetach_mappingā, āmove_mappingā]