model.utils.tensor¶

Tensor and tensor-mapping helpers for ADELM.

Module Contents¶

Functions¶

detach_mapping

Detach all tensors in a dict from the computational graph.

clone_mapping

Return a shallow copy of a dict with all tensors cloned.

move_mapping

Move all tensors in a dict to device.

broadcast_scalar_params

Expand 0-dimensional (scalar) tensors in params to shape [n_entities].

Data¶

API¶

model.utils.tensor.detach_mapping(mapping)¶

Detach all tensors in a dict from the computational graph.

Non-tensor values are passed through unchanged.

model.utils.tensor.clone_mapping(mapping)¶

Return a shallow copy of a dict with all tensors cloned.

Non-tensor values are passed through unchanged.

model.utils.tensor.move_mapping(mapping, device)¶

Move all tensors in a dict to device.

Non-tensor values are passed through unchanged.

model.utils.tensor.broadcast_scalar_params(params, n_entities)¶

Expand 0-dimensional (scalar) tensors in params to 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’]