Miscellaneous

double metatomic_torch::unit_conversion_factor(const std::string &quantity, const std::string &from_unit, const std::string &to_unit)

Get the multiplicative conversion factor to use to convert from unit from to unit to. Both should be units for the given physical quantity.

torch::DeviceType metatomic_torch::pick_device(std::vector<std::string> model_devices, torch::optional<std::string> desired_device = torch::nullopt)

Select the best device according to the list of model_devices from a model, the user-provided desired_device and what’s available on the current machine.

This function returns a c10::DeviceType (torch::DeviceType). It does NOT decide a device index — callers that need a full torch::Device should construct one from the returned DeviceType (and choose an index explicitly). Or let it default away to zero via Device(DeviceType)