ahmedfgad / TorchGA

Train PyTorch Models using the Genetic Algorithm with PyGAD
https://pygad.readthedocs.io
93 stars 15 forks source link

cpu-gpu compatibility #2

Closed rasmuspjohansson closed 2 years ago

rasmuspjohansson commented 2 years ago

Evaluating models usually goes faster with GPU enabled. This simple change enables model_weights_as_vector() and model_weights_as_dict() to work also when torch use GPU for computations.