Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The modifications in this pull request allow for GPU computations through Metal so that a wider range of models become accessible for implementation onto different hardware environments. Integration of GPU devices to execute models in a possibly more efficient way without any compromise to existing functionality is the primary focus of the changes.
Highlights:
Metal GPU Support: The model was rewritten in order to have Metal-enabled GPU execution capability for carrying out computations more efficiently on supported hardware.
Device Compatibility: Enhanced compatibility checks were implemented to ensure the model can properly run on the CPU and GPU, whereas, in the case of any device mismatch, appropriate error handling is set up.
Error Handling: A strong error-handling mechanism was laid down where each petty error is caught and returned when there is an attempt to use a model on an incompatible device (for instance, using GPU with CPU data or vice versa).
Tests for GPU/CPU Mismatches: Far-reaching tests were implemented to check that the model behaves properly on both CPU and GPU and to check that errors are raised when there is a mismatch between the model and the data device.
Testing:
Device Tests: Extensive tests were carried out to check the model's functionality on both CPU and GPU, as well as test beyond that for the right handling of device mismatches.
Scalar Input Handling: Tests were added to ensure that scalar inputs are treated correctly for both the CPU and GPU.