Navigation
API > API/Plugins > API/Plugins/NearestNeighborModelEditor > API/Plugins/NearestNeighborModelEditor/FNearestNeighborEditorModel
- FMLDeformerEditorModel::UpdateTrainingDeviceList()
- FNearestNeighborEditorModel::UpdateTrainingDeviceList()
References
| Module | NearestNeighborModelEditor |
| Header | /Engine/Plugins/Animation/MLDeformer/NearestNeighborModel/Source/NearestNeighborModelEditor/Public/NearestNeighborEditorModel.h |
| Include | #include "NearestNeighborEditorModel.h" |
| Source | /Engine/Plugins/Animation/MLDeformer/NearestNeighborModel/Source/NearestNeighborModelEditor/Private/NearestNeighborEditorModel.cpp |
virtual void UpdateTrainingDeviceList()
Remarks
This should update the list of available training devices. If not implemented, the user won't be able to pick a training device. With training device we mean the device used to store the tensors at. Typically you want to make it build a list of GPU's and have the CPU in there as well.
` UYourTrainingModel* TrainingModel = NewDerivedObject
You can implement the following in Python as an example: ` @unreal.ufunction(override=True) def update_available_devices(self): reload(mldeformer.training_helpers) mldeformer.training_helpers.update_training_device_list(self) _
Then inside the python code you can do something like:
` training_device = model.get_training_device() device_index = mldeformer.training_helpers.find_cuda_device_index(device_name=training_device) if torch.cuda.is_available() and device_index != -1: torch.cuda.set_device(device_index) _