tfep.utils.misc.energies_array_to_tensor

tfep.utils.misc.energies_array_to_tensor(energies, energy_unit=None, dtype=None)[source]

Helper function to convert the a batch of energies from numpy array to PyTorch tensor.

Parameters:
  • energies (pint.Quantity) – The energies with shape (batch_size,) with units.

  • energy_unit (pint.Unit, optional) – The units of energy used in the returned energies. If None, no conversion is performed, and the energy will be in the same units as the input.

  • dtype (type, optional) – The torch data type to be used for the returned Tensor.

Returns:

energies – The energies with shape (batch_size,) as a unitless Tensor in units of energy_unit.

Return type:

torch.Tensor